feat: add main app

This commit is contained in:
Mike 2024-03-16 07:43:40 -04:00
parent 718fdf63b1
commit e7ac5c84f9
2 changed files with 16 additions and 3 deletions

14
battleship/src/app.js Normal file
View file

@ -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);
}
}

View file

@ -1,7 +1,6 @@
import { Player } from './components/player'; import { Player } from './components/player';
import Game from './app';
const player1 = new Player('Player 1'); const player1 = new Player('Player 1');
const player2 = new Player('CPU'); const player2 = new Player('CPU');
const game = new Game({ player1: player1, player2: player2 });
console.log(player1.gameboard);
console.log(player2.gameboard);