private static void TestMove() { var board = MakeBoard("rnbqkbnr/pppppppp/8/8/8/3P4/PPP1PPPP/RNBQKBNR b KQkq -"); //board.DoMove2(new Move(ChessPosition.D2, ChessPosition.D3, ChessPiece.WhitePawn)); //board.UndoMove(); Console.WriteLine(board.Print()); var slidingMoveGenerator = new MagicBitboardsService(); //var evaluationService = new EvaluationService(); //Console.WriteLine(evaluationService.Evaluate(board)); var attacksService = new AttacksService(slidingMoveGenerator); var pinDetector = new PinDetector(slidingMoveGenerator); var validator = new MoveValidator(attacksService, slidingMoveGenerator, pinDetector); var movesService = new MoveGenerator(attacksService, slidingMoveGenerator, pinDetector, validator); var forWhite = true; var moves = new Move[218]; var moveCount = 0; movesService.GetAllLegalMoves(board, moves, ref moveCount); //var dests = moves.Select(x => x.To); //var toMoveBoard = fact.PositionsToBitBoard(dests); //var attacked = attacksService.GetAllAttacked(board); //var newMove = new Move(4,2,ChessPiece.WhiteKing); //board.DoMove2(newMove); //Debugging.ShowBitBoard(board.BitBoard[ChessPiece.WhiteKing], board.BitBoard[ChessPiece.WhiteRook]); }
public static void DoSlideTest() { var board = MakeBoard("8/8/3k2bp/8/8/3K4/8/8 w - - 0 1"); var bishops = board.BitBoard[ChessPiece.BlackBishop]; var bishopPos = bishops.BitScanForward(); var kings = board.BitBoard[ChessPiece.WhiteKing]; var kingPos = kings.BitScanForward(); var slidingMoveGenerator = new MagicBitboardsService(); var result = slidingMoveGenerator.DiagonalAntidiagonalSlide(board.AllPieces, kingPos); var a = 123; }
public Game() { var slidingMoveGenerator = new MagicBitboardsService(); var evaluationService = new EvaluationService2(new EvaluationData()); //var evaluationService = new NnueEvaluationService(new NnueExternalClient()); var attacksService = new AttacksService(slidingMoveGenerator); var pinDetector = new PinDetector(slidingMoveGenerator); var validator = new MoveValidator(attacksService, slidingMoveGenerator, pinDetector); var movesService = new MoveGenerator(attacksService, slidingMoveGenerator, pinDetector, validator); var searchService = new SearchService2(movesService, evaluationService); BoardFact = new BoardFactory(); Hyperbola = slidingMoveGenerator; Evaluation = evaluationService; Attacks = attacksService; Moves = movesService; Search = searchService; }
public static void TestSee() { var board = MakeBoard("1k1r3q/1ppn3p/p4b2/4p3/8/P2N2P1/1PP1R1BP/2K1Q3 w - - 0 1"); var slidingMoveGenerator = new MagicBitboardsService(); var attacksService = new AttacksService(slidingMoveGenerator); var seeService = new SeeService(attacksService); var from = ChessPosition.D3; var to = ChessPosition.E5; var move = new Move(from, to, board.ArrayBoard[from], board.ArrayBoard[to]); //board.DoMove2(move); Console.WriteLine(1UL << move.From); Console.WriteLine(1UL << move.To); Console.WriteLine(board.Print()); var score = seeService.See(board, move); Console.WriteLine(score); }