MCPcopy
hub / github.com/tensorflow/tfjs-examples / reset

Function reset

snake-dqn/index.js:42–53  ·  view source on GitHub ↗

Reset the game state.

()

Source from the content-addressed store, hash-verified

40
41/** Reset the game state. */
42async function reset() {
43 if (game == null) {
44 return;
45 }
46 game.reset();
47 await calcQValuesAndBestAction();
48 renderSnakeGame(gameCanvas, game,
49 showQValuesCheckbox.checked ? currentQValues : null);
50 gameStatusSpan.textContent = 'Game started.';
51 stepButton.disabled = false;
52 autoPlayStopButton.disabled = false;
53}
54
55/**
56 * Play a game for one step.

Callers 1

initGameFunction · 0.85

Calls 3

renderSnakeGameFunction · 0.90
calcQValuesAndBestActionFunction · 0.85
resetMethod · 0.45

Tested by

no test coverage detected