Esempio n. 1
0
        private void SyncBoardToUI()
        {
            _currentPlayer = _board.CurrentPlayer == SquareState.Black ? _blackPlayer : _whitePlayer;

            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 8; x++)
                {
                    _squares[x, y].State = _board[x, y];

                    _squares[x, y].ShowAsValidMove((_currentPlayer == null) &&
                                                   _board.IsValidMove(new OthelloMove(x, y)));

                    _squares[x, y].ShowAsLastMovePlayed(_lastPlayedMove != null &&
                                                        _lastPlayedMove.X == x && _lastPlayedMove.Y == y);
                }
            }

            BlackCount.Text = _board.BlackSquares.ToString();
            WhiteCount.Text = _board.WhiteSquares.ToString();
            EmptyCount.Text = _board.EmptySquares.ToString();
        }