Created
August 13, 2018 17:41
-
-
Save MikeShi42/9459db59ac478d414d328544b6d22e1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sends the updated grid to the actuator | |
actuate() { | |
if (this.storageManager.getBestScore() < this.score) { | |
this.storageManager.setBestScore(this.score); | |
} | |
// Clear the state when the game is over (game over only, not win) | |
if (this.over) { | |
this.storageManager.clearGameState(); | |
} else { | |
this.storageManager.setGameState(this.serialize()); | |
} | |
const grid = this.grid; | |
const metadata = { | |
score: this.score, | |
over: this.over, | |
won: this.won, | |
bestScore: this.storageManager.getBestScore(), | |
terminated: this.isGameTerminated() | |
}; | |
this.actuator.actuate(grid, metadata); | |
this.sendRemoteMove(grid, metadata); // Call our sendRemoteMove function! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment