Skip to content

Instantly share code, notes, and snippets.

@melcor76
Last active September 12, 2020 15:14
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 melcor76/46fcae2d403cf01fc295c8571555bd41 to your computer and use it in GitHub Desktop.
Save melcor76/46fcae2d403cf01fc295c8571555bd41 to your computer and use it in GitHub Desktop.
js-tetris - board first
class Board {
// Reset the board when we start a new game.
reset() {
this.grid = this.getEmptyBoard();
}
// Get matrix filled with zeros.
getEmptyBoard() {
return Array.from(
{length: ROWS}, () => Array(COLS).fill(0)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment