|
@@ -10,9 +10,10 @@ const gameTiles = [
|
|
* Render the arcade screen
|
|
* Render the arcade screen
|
|
*
|
|
*
|
|
* @param {number[]} screenState An array of numbers represent the state of the arcade screen
|
|
* @param {number[]} screenState An array of numbers represent the state of the arcade screen
|
|
|
|
+ * @param {boolean} countBlocks Display a count of block tiles on the screen
|
|
* @returns {void}
|
|
* @returns {void}
|
|
*/
|
|
*/
|
|
-function render(screenState) {
|
|
|
|
|
|
+function render(screenState, countBlocks = false) {
|
|
if (screenState.length % 3 != 0) {
|
|
if (screenState.length % 3 != 0) {
|
|
console.warn("screenState length is not divisible by three!");
|
|
console.warn("screenState length is not divisible by three!");
|
|
}
|
|
}
|
|
@@ -53,7 +54,9 @@ function render(screenState) {
|
|
|
|
|
|
console.clear();
|
|
console.clear();
|
|
console.log(boardString);
|
|
console.log(boardString);
|
|
- console.log("\n", "Block tiles: ", blockTileCount);
|
|
|
|
|
|
+ if (countBlocks) {
|
|
|
|
+ console.log("\n", "Block tiles: ", blockTileCount);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function normalizeBoard(board, width, height) {
|
|
function normalizeBoard(board, width, height) {
|