Beispiel #1
0
        public Board GetDefault()
        {
            var result = new Board(8, 8);

            AddWhitePieces(result);
            AddBlackPieces(result);

            for (int i = 0; i < 8; i++)
            {
                result.PlacePiece(1, i, EnumBoardSquare.White | EnumBoardSquare.Pawn | EnumBoardSquare.NotMoved);
            }

            for (int i = 0; i < 8; i++)
            {
                result.PlacePiece(6, i, EnumBoardSquare.Black | EnumBoardSquare.Pawn | EnumBoardSquare.NotMoved);
            }

            return(result);
        }
Beispiel #2
0
        private void AddBlackPieces(Board result)
        {
            if (result.Cols != 8)
            {
                throw new Exception();
            }

            result.PlacePiece(7, 0, EnumBoardSquare.Black | EnumBoardSquare.Rook | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 1, EnumBoardSquare.Black | EnumBoardSquare.Knight | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 2, EnumBoardSquare.Black | EnumBoardSquare.Bishop | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 3, EnumBoardSquare.Black | EnumBoardSquare.Queen | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 4, EnumBoardSquare.Black | EnumBoardSquare.King | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 5, EnumBoardSquare.Black | EnumBoardSquare.Bishop | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 6, EnumBoardSquare.Black | EnumBoardSquare.Knight | EnumBoardSquare.NotMoved);
            result.PlacePiece(7, 7, EnumBoardSquare.Black | EnumBoardSquare.Rook | EnumBoardSquare.NotMoved);
        }
Beispiel #3
0
        private void AddWhitePieces(Board result)
        {
            if (result.Cols != 8)
            {
                throw new Exception();
            }

            result.PlacePiece(0, 0, EnumBoardSquare.White | EnumBoardSquare.Rook | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 1, EnumBoardSquare.White | EnumBoardSquare.Knight | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 2, EnumBoardSquare.White | EnumBoardSquare.Bishop | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 3, EnumBoardSquare.White | EnumBoardSquare.Queen | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 4, EnumBoardSquare.White | EnumBoardSquare.King | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 5, EnumBoardSquare.White | EnumBoardSquare.Bishop | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 6, EnumBoardSquare.White | EnumBoardSquare.Knight | EnumBoardSquare.NotMoved);
            result.PlacePiece(0, 7, EnumBoardSquare.White | EnumBoardSquare.Rook | EnumBoardSquare.NotMoved);
        }