Skip to content

Instantly share code, notes, and snippets.

@slior

slior/game.js Secret

Created November 17, 2020 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slior/de1fa1c82a8dd891f8dee303d1ad6e47 to your computer and use it in GitHub Desktop.
Save slior/de1fa1c82a8dd891f8dee303d1ad6e47 to your computer and use it in GitHub Desktop.
Mancala (27b8690b292cc3b612debb26a40609bb882c0ab4) - refactoring drawing code to the BoardUI class
...
const {BoardUI} = require("./drawing.js")
...
class MancalaGame
{
constructor (...)
{
...
this.boardUI = new BoardUI(cnvsELID,this.cellCount,this)
this.boardUI.initializeBoardDrawing();
}
_redraw()
{
this.boardUI.drawBoardState(this.board,this);
}
togglePlayer()
{
this.player = this.player.theOtherOne();
this.boardUI.toggleHighlights(this.player.number);
return this.player;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment