Open Kaanavciexe opened 1 year ago
If you're willing to use bitboards, you can use ChessChallenge.Chess.Bits.KnightAttacks[knightSquare] to get the bitboard of all the knight's attacks
You could also count the legal moves that start at the knights position. Don't know if that's exactly what your asking for
I don't think you're allowed to use this namespace: ChessChallenge.Chess
you can use the ChessChallenge.API.GetKnightAttacks to get the knights bitboard ChessChallenge.API is defiantly allowed where I also don't think ChessChallenge.Chess is allowed
if you want to see if it is attacking something it is a bit clunky in this situation as you need to test it against a square to see if it is attacking that square, I'm not sure how you can get it to list all squares in the bitboard (without looping all squares).
I'm am using it to check for attacks on specific pieces like this ulong Attacks = board.GetAllPieceLists(); OR ulong Attacks = p_board.GetPieceList(PieceType, IsWhite); to get specific pieces then loop through the pieces and use ChessChallenge.API.BitboardHelper.SquareIsSet(Attacks, piece.Square)
hope this helps, if anyone has a better way please post it here
I want to get our Piece's attacking squares or get a square's attacking pieces. For example my knight on f3 and i want to take its attacking squares for example e5, g5... IS there any way to do this?