From e7ac5c84f9b5db73a9d46b4dac7951c4cdee960b Mon Sep 17 00:00:00 2001 From: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Sat, 16 Mar 2024 07:43:40 -0400 Subject: [PATCH] feat: add main app --- battleship/src/app.js | 14 ++++++++++++++ battleship/src/index.js | 5 ++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 battleship/src/app.js diff --git a/battleship/src/app.js b/battleship/src/app.js new file mode 100644 index 0000000..1fc9a84 --- /dev/null +++ b/battleship/src/app.js @@ -0,0 +1,14 @@ +export default class Game { + constructor(players) { + this.player1 = players.player1; + this.palyer2 = players.player2; + this.main(); + } + + main() { + // TODO take turns picking points to shoot a ship + this.player1.gameboard.receiveAttack([1, 2]); + this.player1.gameboard.receiveAttack([3, 8]); + console.log(this.player1.gameboard); + } +} diff --git a/battleship/src/index.js b/battleship/src/index.js index 938f857..0f196de 100644 --- a/battleship/src/index.js +++ b/battleship/src/index.js @@ -1,7 +1,6 @@ import { Player } from './components/player'; +import Game from './app'; const player1 = new Player('Player 1'); const player2 = new Player('CPU'); - -console.log(player1.gameboard); -console.log(player2.gameboard); +const game = new Game({ player1: player1, player2: player2 });