private void UpdateGameBoard() { _gameBoard = null; if (_player != null) { List<Move> moves = _player.Game.Moves.ToList(); moves.Sort(new MoveComparer()); int expectedIndex = 0; _gameBoard = GameBoard.OpeningPosition; foreach (Move move in moves) { if (move.Index != expectedIndex) return; if (move.Player.Index == 0 && _gameBoard.ToMove != PieceColor.Black) return; if (move.Player.Index == 1 && _gameBoard.ToMove != PieceColor.White) return; Square square = Square.FromIndex(move.Square); if (!_gameBoard.LegalMoves.Contains(square)) return; _gameBoard = _gameBoard.AfterMove(square); ++expectedIndex; } } }
private void UpdateGameBoard() { _depGameBoardRaw.OnGet(); _priorBoard = _priorBoardRaw; _gameBoard = _gameBoardRaw; if (_mainNavigation.PendingMove != null && _gameBoard.LegalMoves.Contains(_mainNavigation.PendingMove)) { _priorBoard = _gameBoard; _gameBoard = _priorBoard.AfterMove(_mainNavigation.PendingMove); } }