示例#1
0
 /// <summary>
 /// Checks and updates the game state based on previous actions
 /// </summary>
 internal void CheckGameState()
 {
     var boardWinner = Board.Winner();
     if (boardWinner != null)
     {
         WinStatus = GameWinStatus.Win;
         Winner = boardWinner;
     }
     else
     {
         if (!Board.IsFull())
             return;
         WinStatus = GameWinStatus.Tie;
         Winner = null;
     }
     ActionLog(string.Format("Game Finished[{0}]: {1}", WinStatus, Winner));
     Status = GameStatus.Finished;
 }
示例#2
0
 public RunResult(IPlayer winner, GameWinStatus status, long milliseconds)
 {
     Winner = winner;
     Status = status;
     Milliseconds = milliseconds;
 }
示例#3
0
        public void Reset()
        {
            Status = GameStatus.Running;
            WinStatus = GameWinStatus.None;
            Winner = null;
            Board = new GameBoard();
            GameActions = new List<GameAction>();
            GameLog = new List<string>();
            ActionQueue = new ConcurrentQueue<GameAction>();

            OnPropertyChanged("Board");
            OnPropertyChanged("GameActions");
            OnPropertyChanged("GameLog");
        }