Added a parameter to the render function to toggle the display of the count of block tiles on the screen
@@ -12,5 +12,4 @@ const sampleInput = [104, 1, 104, 2, 104, 3, 104, 6, 104, 5, 104, 4, 99];
const arcade = new Computer(input);
arcade.Run();
-// console.log(arcade.outputValues);
-render(arcade.outputValues);
+render(arcade.outputValues, true);
@@ -10,9 +10,10 @@ const gameTiles = [
* Render 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}
*/
-function render(screenState) {
+function render(screenState, countBlocks = false) {
if (screenState.length % 3 != 0) {
console.warn("screenState length is not divisible by three!");
}
@@ -53,7 +54,9 @@ function render(screenState) {
console.clear();
console.log(boardString);
- console.log("\n", "Block tiles: ", blockTileCount);
+ if (countBlocks) {
+ console.log("\n", "Block tiles: ", blockTileCount);
+ }
function normalizeBoard(board, width, height) {