Exemplo n.º 1
0
        /// <summary>
        /// Initializes static members of the <see cref="ChessboardManager"/> class.
        /// </summary>
        static ChessboardManager()
        {
            ValidKingMoves = new Dictionary<string, Move>();
            ValidKingMoves["DL"] = new Move(1, -1);
            ValidKingMoves["DR"] = new Move(1, 1);
            ValidKingMoves["UL"] = new Move(-1, -1);
            ValidKingMoves["UR"] = new Move(-1, 1);

            ValidPawnMoves = new Dictionary<string, Move>();
            ValidPawnMoves["DL"] = new Move(1, -1);
            ValidPawnMoves["DR"] = new Move(1, 1);
        }
Exemplo n.º 2
0
        private void UpdatePosition(ChessPiece chessPiece, Move move)
        {
            this.occupied[chessPiece.Row, chessPiece.Col] = false;

            chessPiece.Row += move.DeltaRow;
            chessPiece.Col += move.DeltaCol;
            chessPiece.MovesMade++;

            this.occupied[chessPiece.Row, chessPiece.Col] = true;
        }