private static ulong[] RookMoves() { var Result = new ulong[64]; var Address = new BoardAddress(0); for (int i = 0; i < 64; i++) { Address.Index = i; Result[i] = Masks.Ranks[Address.Rank] ^ Masks.Files[Address.File]; } return(Result); }
private static ulong[] BishopMoves() { var Result = new ulong[64]; var Address = new BoardAddress(0); for (int i = 0; i < 64; i++) { Address.Index = i; Result[i] = Masks.Slash[Address.SlashIndex] ^ Masks.BackSlash[Address.BackSlashIndex]; } return(Result); }
private static ulong[] PawnMoves(bool white) { var Result = new ulong[64]; ulong Position = 1; var Address = new BoardAddress(0); for (int i = 0; i < 64; i++) { Address.Index = i; if (white) // white { if (Address.Rank > 0) { Result[i] = Position << 8; // single move if (Address.Rank == 1) { Result[i] |= Position << 16; // double move } } else { Result[i] = 0; // not applicable } } else // black { if (Address.Rank < 7) { Result[i] = Position >> 8; // single move if (Address.Rank == 6) { Result[i] |= Position >> 16; // double move } } else { Result[i] = 0; // not applicable } } Position <<= 1; } return(Result); }
private static ulong[] PawnCaptures(bool white) { var Result = new ulong[64]; ulong Position = 1; ulong Moves = 0; var Address = new BoardAddress(0); for (int i = 0; i < 64; i++) { Address.Index = i; if (white) // white { if (Address.Rank > 0) { Moves = (Position << 7) & ~Masks.FileH; Moves |= (Position << 9) & ~Masks.FileA; Result[i] = Moves; } else { Result[i] = 0; // not applicable } } else // black { if (Address.Rank < 7) { Moves = (Position >> 7) & ~Masks.FileA; Moves |= (Position >> 9) & ~Masks.FileH; Result[i] = Moves; } else { Result[i] = 0; // not applicable } } Position <<= 1; } return(Result); }