Ejemplo n.º 1
0
        private static Engine PuzzleRookCandidate()
        {
            Engine engine = new Engine("");

            Random random = new Random(DateTime.Now.Second);

            byte whiteKingIndex;
            byte blackKingIndex;
            byte whiteRookIndex;

            do
            {
                whiteKingIndex = (byte)random.Next(63);
                blackKingIndex = (byte)random.Next(63);
                whiteRookIndex = (byte)random.Next(63);
            }while (
                whiteKingIndex == blackKingIndex ||
                whiteKingIndex == whiteRookIndex ||
                blackKingIndex == whiteKingIndex
                );

            Piece whiteKing = new Piece(ChessPieceType.King, ChessPieceColor.White);
            Piece whiteRook = new Piece(ChessPieceType.Rook, ChessPieceColor.White);
            Piece blackKing = new Piece(ChessPieceType.King, ChessPieceColor.Black);

            engine.SetChessPiece(whiteKing, whiteKingIndex);
            engine.SetChessPiece(blackKing, blackKingIndex);
            engine.SetChessPiece(whiteRook, whiteRookIndex);

            engine.GenerateValidMoves();
            engine.EvaluateBoardScore();

            return(engine);
        }
Ejemplo n.º 2
0
        private static Engine PuzzleKnightBishopCandidate()
        {
            var engine = new Engine("");

            var random = new Random(DateTime.Now.Second);

            byte whiteKingIndex;
            byte blackKingIndex;
            byte whiteKnightIndex;
            byte whiteBishopIndex;

            do
            {
                whiteKingIndex   = (byte)random.Next(63);
                blackKingIndex   = (byte)random.Next(63);
                whiteKnightIndex = (byte)random.Next(63);
                whiteBishopIndex = (byte)random.Next(63);
            } while (
                whiteKingIndex == blackKingIndex ||
                whiteKingIndex == whiteBishopIndex ||
                whiteKingIndex == whiteKnightIndex ||
                whiteKnightIndex == whiteBishopIndex ||
                blackKingIndex == whiteBishopIndex ||
                blackKingIndex == whiteKingIndex
                );

            var whiteKing   = new Piece(ChessPieceType.King, ChessPieceColor.White);
            var whiteBishop = new Piece(ChessPieceType.Bishop, ChessPieceColor.White);
            var whiteKnight = new Piece(ChessPieceType.Knight, ChessPieceColor.White);
            var blackKing   = new Piece(ChessPieceType.King, ChessPieceColor.Black);

            engine.SetChessPiece(whiteKing, whiteKingIndex);
            engine.SetChessPiece(blackKing, blackKingIndex);
            engine.SetChessPiece(whiteKnight, whiteKnightIndex);
            engine.SetChessPiece(whiteBishop, whiteBishopIndex);

            engine.GenerateValidMoves();
            engine.EvaluateBoardScore();

            return(engine);
        }