From 6d5050fa793d95f6557ddcdb3c580b0daad2bd29 Mon Sep 17 00:00:00 2001 From: Evan Powell Date: Mon, 7 Sep 2020 20:13:18 -0500 Subject: [PATCH] added to the advance game state: added the choosing boats number of boats prereq, started on the player's placement prereq(#2) --- src/services/GameState.service.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/services/GameState.service.js b/src/services/GameState.service.js index 57c044b..1fdf812 100644 --- a/src/services/GameState.service.js +++ b/src/services/GameState.service.js @@ -243,6 +243,34 @@ export class GameStateService { * 8) player win * */ + //1 + if(this.current_state === GameState.ChoosingNumberOfShips) + { + if(this.n_boats >= 1 && this.n_boats <= 5 ) + { + this.current_state = GameState.PlayerSetup; + this.current_player = Player.One; + this.current_opponent = Player.Two; + } + else + { + throw new Error("Invalid Number of Boats"); + } + + } + if(this.current_state === GameState.PlayerSetup) + { + if(this.current_player === Player.One) + { + //wait + } + if(this.current_player === Player.Two) + { + //wait for now + } + } + + } }