-
-
Save melcor76/46fcae2d403cf01fc295c8571555bd41 to your computer and use it in GitHub Desktop.
js-tetris - board first
This file contains 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
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