예제 #1
0
파일: Board.cs 프로젝트: hymeck/Chess
        private static Dictionary <Square, Piece> GetStartMap()
        {
            var map = new Dictionary <Square, Piece>(64);

            map[new Square(0, 7)] = PieceFactory.BlackRook();
            map[new Square(1, 7)] = PieceFactory.BlackKnight();
            map[new Square(2, 7)] = PieceFactory.BlackBishop();
            map[new Square(3, 7)] = PieceFactory.BlackQueen();
            map[new Square(4, 7)] = PieceFactory.BlackKing();
            map[new Square(5, 7)] = PieceFactory.BlackBishop();
            map[new Square(6, 7)] = PieceFactory.BlackKnight();
            map[new Square(7, 7)] = PieceFactory.BlackRook();
            map[new Square(0, 6)] = PieceFactory.BlackPawn();
            map[new Square(1, 6)] = PieceFactory.BlackPawn();
            map[new Square(2, 6)] = PieceFactory.BlackPawn();
            map[new Square(3, 6)] = PieceFactory.BlackPawn();
            map[new Square(4, 6)] = PieceFactory.BlackPawn();
            map[new Square(5, 6)] = PieceFactory.BlackPawn();
            map[new Square(6, 6)] = PieceFactory.BlackPawn();
            map[new Square(7, 6)] = PieceFactory.BlackPawn();

            for (int y = 2; y < 6; y++)
            {
                for (int x = 0; x < 8; x++)
                {
                    map.Add(new Square(x, 7 - y), Piece.NonePiece);
                }
            }

            map[new Square(0, 1)] = PieceFactory.WhitePawn();
            map[new Square(1, 1)] = PieceFactory.WhitePawn();
            map[new Square(2, 1)] = PieceFactory.WhitePawn();
            map[new Square(3, 1)] = PieceFactory.WhitePawn();
            map[new Square(4, 1)] = PieceFactory.WhitePawn();
            map[new Square(5, 1)] = PieceFactory.WhitePawn();
            map[new Square(6, 1)] = PieceFactory.WhitePawn();
            map[new Square(7, 1)] = PieceFactory.WhitePawn();
            map[new Square(0, 0)] = PieceFactory.WhiteRook();
            map[new Square(1, 0)] = PieceFactory.WhiteKnight();
            map[new Square(2, 0)] = PieceFactory.WhiteBishop();
            map[new Square(3, 0)] = PieceFactory.WhiteQueen();
            map[new Square(4, 0)] = PieceFactory.WhiteKing();
            map[new Square(5, 0)] = PieceFactory.WhiteBishop();
            map[new Square(6, 0)] = PieceFactory.WhiteKnight();
            map[new Square(7, 0)] = PieceFactory.WhiteRook();

            return(map);
        }