Example #1
0
 private Enums.GameOutcome ProcessIllegalMove(StreamWriter logFile, Enums.GameOutcome gameOutcome, ref Player winner)
 {
     logFile.WriteLine("[GAME] : Illegal move made by " + _currentPlayer.GetPlayerName());
     gameOutcome = Enums.GameOutcome.IllegalMazeState;
     winner      = _playerPool.GetNextPlayer();
     return(gameOutcome);
 }
Example #2
0
 private Player DetermineIfWinner(Enums.GameOutcome gameOutcome, Player winner)
 {
     if (gameOutcome != Enums.GameOutcome.ProceedToNextRound)
     {
         winner = GameJudge.DetermineWinner(_playerPool, gameOutcome);
     }
     return(winner);
 }
Example #3
0
 public static Player DetermineWinner(PlayerPool playerPool, Enums.GameOutcome gameOutcome)
 {
     if (playerPool.GetPlayers()[0].GetScore() != playerPool.GetPlayers()[1].GetScore())
     {
         return(playerPool.GetPlayers().OrderByDescending(x => x.GetScore()).First());
     }
     if (gameOutcome == Enums.GameOutcome.NoScoringMaxed)
     {
         return(playerPool.GetNextPlayer());
     }
     return(null);
 }
Example #4
0
 private Player DeterminIfWinner(Enums.GameOutcome gameOutcome, Maze mazeFromPlayer, Player winner)
 {
     mazeFromPlayer.SwapPlayerSymbols();
     _maze = mazeFromPlayer;
     if (_maze.FindCoordinateOf(_secondMazePlayer).IsEmpty)
     {
         _maze.SetSymbol(Properties.Settings.Default.MazeCenterX, Properties.Settings.Default.MazeCenterY, _secondMazePlayer);
     }
     if (gameOutcome != Enums.GameOutcome.ProceedToNextRound)
     {
         winner = GameJudge.DetermineWinner(_playerPool, gameOutcome);
     }
     return(winner);
 }
Example #5
0
 private void CreateMatchInfo(Enums.GameOutcome gameOutcome, Player winner, StreamWriter file)
 {
     foreach (var player in _playerPool.GetPlayers())
     {
         file.WriteLine("PLAYER:" + player.GetSymbol() + "," + player.GetPlayerName() + "," + player.GetScore());
     }
     if (winner == null)
     {
         file.WriteLine("GAME: DRAW," + gameOutcome + "," + _iteration);
     }
     else
     {
         file.WriteLine("GAME: " + winner.GetSymbol() + "," + gameOutcome + "," + _iteration);
     }
 }
Example #6
0
 private Player DeterminIfWinner(Enums.GameOutcome gameOutcome, Maze mazeFromPlayer, Player winner)
 {
     mazeFromPlayer.SwapPlayerSymbols();
     _maze = mazeFromPlayer;
     if (gameOutcome != Enums.GameOutcome.ProceedToNextRound)
     {
         if (gameOutcome == Enums.GameOutcome.NoScoringMaxed)
         {
             winner = _playerPool.GetNextPlayer();
         }
         else
         {
             winner = GameJudge.DetermineWinner(_playerPool);
         }
     }
     return(winner);
 }
Example #7
0
 private Enums.GameOutcome GetGameOutcome(Maze mazeFromPlayer, StreamWriter logFile, Enums.GameOutcome gameOutcome, Enums.TurnOutcome turnOutcome)
 {
     logFile.WriteLine("[GAME] : Player " + _currentPlayer.GetPlayerName() + " has " + _currentPlayer.GetScore() + " points");
     logFile.WriteLine("[TURN] : Moved to " + _currentPlayer.GetCurrentPosition().X + ", " + _currentPlayer.GetCurrentPosition().Y);
     gameOutcome = _gameMarshaller.ProcessGame(mazeFromPlayer, turnOutcome);
     logFile.WriteLine("[TURN] : " + _gameMarshaller.GetTurnsWithoutPointsInfo() + " turns without points");
     logFile.WriteLine("[GAME] : " + gameOutcome);
     return(gameOutcome);
 }