Skip to content

Instantly share code, notes, and snippets.

@pastullo
pastullo / app.js
Created February 22, 2023 15:43
Battleship
const GRID_SIZE = 10;
const SHIP_SIZES = [5, 4, 4];
const board = new Array(GRID_SIZE).fill(null).map(() => new Array(GRID_SIZE).fill(0));
const hits = new Array(GRID_SIZE).fill(null).map(() => new Array(GRID_SIZE).fill(false));
// Let's place the ships on the board