protected void PlayGame(Game game) { if (!game.IsPlayed) { if (game.SecondPlayer != null) { _printer.EnterPlayerScore(game.FirstPlayer); var firstPlayerScore = _printer.GetPlayerScore(); _printer.EnterPlayerScore(game.SecondPlayer); var secondPlayerScore = _printer.GetPlayerScore(); while (firstPlayerScore == secondPlayerScore) { _printer.DrawIsNotPossible(); _printer.EnterPlayerScore(game.FirstPlayer); firstPlayerScore = _printer.GetPlayerScore(); _printer.EnterPlayerScore(game.SecondPlayer); secondPlayerScore = _printer.GetPlayerScore(); } game.Play(firstPlayerScore, secondPlayerScore); _printer.PrintGameResult(game); } else { game.Play(); } SaveLoadSystem.Save(this); } }
public virtual void StartTournament() { WinnersGrid = new List <List <Game> >(); WinnersGrid.Add(new List <Game>()); DataInput dataInput = new DataInput(_printer); CountOfPlayers = dataInput.GetCountOfPlayers(); var players = dataInput.GetPlayersList(CountOfPlayers); for (int i = 0; i < players.Count; i += 2) { var firstPlayer = players[i]; Player secondPlayer = null; if (i != players.Count - 1) { secondPlayer = players[i + 1]; } WinnersGrid[_currentWinnersStage].Add(new Game(firstPlayer, secondPlayer)); _gamesOnCurrentWinnersStage++; } SaveLoadSystem.Save(this); }
protected void InitNewWinnersGridStage() { _currentWinnersStage++; FillNewStage(WinnersGrid, _currentWinnersStage); _gamesOnCurrentWinnersStage = WinnersGrid[_currentWinnersStage].Count; SaveLoadSystem.Save(this); }
public override void StartTournament() { base.StartTournament(); LosersGrid = new List <List <Game> >(); LosersGrid.Add(new List <Game>()); SaveLoadSystem.Save(this); }
private void InitNewLosersGridStage() { _currentLosersStage++; if (_currentLosersStage > 0) { FillNewStage(LosersGrid, _currentLosersStage); _gamesOnCurrentLosersStage = LosersGrid[_currentLosersStage].Count; } if (_currentLosersStage <= _currentWinnersStage) { FillLosersStageByWinnersGrid(); } SaveLoadSystem.Save(this); }