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

Method getState

snake-dqn/snake_game.js:319–324  ·  view source on GitHub ↗

* Get plain JavaScript representation of the game state. * * @return An object with two keys: * - s: {Array<[number, number]>} representing the squares occupied by * the snake. The array is ordered in such a way that the first * element corresponds to the head of the s

()

Source from the content-addressed store, hash-verified

317 * the fruit(s).
318 */
319 getState() {
320 return {
321 "s": this.snakeSquares_.slice(),
322 "f": this.fruitSquares_.slice()
323 }
324 }
325}
326
327/**

Callers 8

resetMethod · 0.95
stepMethod · 0.95
snake_game_test.jsFile · 0.80
calcQValuesAndBestActionFunction · 0.80
initGameFunction · 0.80
renderSnakeGameFunction · 0.80
agent_test.jsFile · 0.80
playStepMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected