private void PlayerTakeTurn(Player player, GameState gameState) { while (gameState.CurrentPlayerTurn == player && !IsGameOver(gameState)) { AEvent playerEvent = this.eventProvider.WaitForEvent(); EventRunner.RunEvent(playerEvent, gameState); } }
public void PlayGame() { GameState gameState = StartingGameState(this.DeckPlayer1, this.DeckPlayer2); const int START_HAND_SIZE = 5; EventRunner.RunEvent(new GameStartCardDrawEvent(START_HAND_SIZE), gameState); Player playerTurn = FirstPlayerCoinToss(); while (!IsGameOver(gameState)) { PlayerTakeTurn(playerTurn, gameState); playerTurn = NextPlayer(playerTurn); } EventRunner.RunEvent(new GameOverEvent(), gameState); }