Exemplo n.º 1
0
        /// <summary>
        /// Gets a board in the starting position.
        /// </summary>
        /// <returns></returns>
        public static Board GetStartingBoard()
        {
            Piece[]     squares = new Piece[SquareNo];
            BoardStatus status  = new BoardStatus();

            squares[A8] = new BlackRook();
            squares[B8] = new BlackKnight();
            squares[C8] = new BlackBishop();
            squares[D8] = new BlackQueen();
            squares[E8] = new BlackKing();
            squares[F8] = new BlackBishop();
            squares[G8] = new BlackKnight();
            squares[H8] = new BlackRook();

            for (int sqIndex = SideSquareNo; sqIndex < SideSquareNo * 2; sqIndex++)
            {
                squares[sqIndex] = new BlackPawn();
            }

            for (int sqIndex = SideSquareNo * (SideSquareNo - 2); sqIndex < SideSquareNo * (SideSquareNo - 1); sqIndex++)
            {
                squares[sqIndex] = new WhitePawn();
            }

            squares[A1] = new WhiteRook();
            squares[B1] = new WhiteKnight();
            squares[C1] = new WhiteBishop();
            squares[D1] = new WhiteQueen();
            squares[E1] = new WhiteKing();
            squares[F1] = new WhiteBishop();
            squares[G1] = new WhiteKnight();
            squares[H1] = new WhiteRook();

            status.WhiteTurn            = true;
            status.WhiteCouldCastleLong = status.WhiteCouldCastleShort = status.BlackCouldCastleLong = status.BlackCouldCastleShort = true;
            status.EnPassantTarget      = null;
            status.Ply   = 0;
            status.Moves = 1;

            return(new Board(squares, status));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a board in the starting position.
        /// </summary>
        /// <returns></returns>
        public static Board GetStartingBoard()
        {
            Piece[] squares = new Piece[SquareNo];
            BoardStatus status = new BoardStatus();

            squares[A8] = new BlackRook();
            squares[B8] = new BlackKnight();
            squares[C8] = new BlackBishop();
            squares[D8] = new BlackQueen();
            squares[E8] = new BlackKing();
            squares[F8] = new BlackBishop();
            squares[G8] = new BlackKnight();
            squares[H8] = new BlackRook();

            for (int sqIndex = SideSquareNo; sqIndex < SideSquareNo * 2; sqIndex++)
            {
                squares[sqIndex] = new BlackPawn();
            }

            for (int sqIndex = SideSquareNo * (SideSquareNo - 2); sqIndex < SideSquareNo * (SideSquareNo - 1); sqIndex++)
            {
                squares[sqIndex] = new WhitePawn();
            }

            squares[A1] = new WhiteRook();
            squares[B1] = new WhiteKnight();
            squares[C1] = new WhiteBishop();
            squares[D1] = new WhiteQueen();
            squares[E1] = new WhiteKing();
            squares[F1] = new WhiteBishop();
            squares[G1] = new WhiteKnight();
            squares[H1] = new WhiteRook();

            status.WhiteTurn = true;
            status.WhiteCouldCastleLong = status.WhiteCouldCastleShort = status.BlackCouldCastleLong = status.BlackCouldCastleShort = true;
            status.EnPassantTarget = null;
            status.Ply = 0;
            status.Moves = 1;

            return new Board(squares, status);
        }