Beispiel #1
0
        public void CellWasClicked(CellCord cellCord)
        {
            if (_gameMoveValidator.InvalidMove(_board, cellCord))
            {
                _gameDisplay.ShowMessage($"Player: {CurrentPlayer.Name} Not Valid Move");
            }
            else
            {
                UpdateBoard(cellCord);

                var condition = _conditions.FirstOrDefault(e => e.ConditionMet(CurrentPlayer.Symbol, _board));

                if (condition == null)
                {
                    GameContinues();
                }
                else
                {
                    GameEnded(condition);
                }
            }
        }
Beispiel #2
0
 private void UpdateBoard(CellCord cellCord)
 {
     _board.Set(CurrentPlayer.Symbol, cellCord.X, cellCord.Y);
     _gameDisplay.SetCell(cellCord, CurrentPlayer.Symbol);
 }
Beispiel #3
0
 public void SetCell(CellCord cellCord, Enums.Symbol cellState)
 {
     _grid[cellCord.X, cellCord.Y].CellState = cellState;
 }
Beispiel #4
0
 public bool InvalidMove(IGameBoard board, CellCord cellCord)
 {
     return(board.Get(cellCord.X, cellCord.Y) != Enums.Symbol.Empty);
 }
Beispiel #5
0
 public void SetCell(CellCord cellCord, Enums.Symbol cellState)
 {
     gameBoardDispaly1.SetCell(cellCord, cellState);
 }