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N2RRXFBQVPT3A5QAXTUCQ3UUU5AC
GDHXEMN5IXJDS63G3DUZH5PR2XH2SSXISABF2JHCYA3JSRXDPLMQC
A23ETUI3HMBQKCAROPWHAJ36CRQ3QFR27ZVRNJWDKAIPOBXYUAOAC
XHCMZF25YBLNQLVKKBJJWWJ3G24VFUSLE3LAT2DRWL52RJX4Z3EAC
46RTAHPCLRHCLSYGKZIFIFRIWPJ54TJJ2WM5M5FZNNHUSZZZZAYQC
FOORIA7SEZCLKDBNMV6KEDTQOJJVAH57BQFBRSQMET6FERJPHCVQC
6S6HHKOXBQ5ARL7S7PKMPDIAH3VTPOAPWWSMGY37RP2R2U662FBAC
FRUDIRWXGFOZERET3DNUNAZ5HSA3G32JZX6WMIXNGZOACTTCRIQAC
3H3DSWLBWCE7C43W6LHICCPJ5KQDLASLQPIKJOK2KAE6OFF2L6WAC
V34YWVR66ERHUV6SOYQWJQLYMPLWEIJDXCR44B3SLPN2CRYIR45QC
BL3ZR4OWJM54HFXUNMUZKB5YQYVBT7ETFIXCOXWL6S5SZFM6IFDQC
WTTQGET65BQV7NSFOI75JGCTWFS6R73OFZE4V63JYWAODNIOUAHQC
ET37VV7TCQDN6RWF46EUJB6EPNSDOX5TI25NW4P4H5HI4VOTARZQC
TDHJSFFSJZBEZFMDHPLRSVB6CIVJ7AWGGNIC3WUCADQLQSIQKXDAC
A46B5KNQFPTZEIL2JZKD2CQELGU3COE6FGTV2ABS5U7DVTVDGEBQC
EVNZGIR45TJBV5XC5K3NKWIW2IP75QW4R3LMNTSP7BWTRHNFDRDQC
WZNDXPQM23LLYDZ3ZCTB4GOVRJLL7PMSEPSYBVFX6AOTJOZ5YYZQC
ITBUR5DO3QNEPXLYLFZP2OZIRI4LJU66R3TAD3F4D3YPUR4E2VMQC
move.source = @intToEnum(Square, (in[0] - 'a' + (8 - (in[1] - '0')) * SIZE));
move.target = @intToEnum(Square, (in[2] - 'a' + (8 - (in[3] - '0')) * SIZE));
move.source = @enumFromInt(Square, (in[0] - 'a' + (8 - (in[1] - '0')) * SIZE));
move.target = @enumFromInt(Square, (in[2] - 'a' + (8 - (in[3] - '0')) * SIZE));
.p => -PAWN_SCORE[@enumToInt(MIRROR_SCORE[bit])],
.n => -KNIGHT_SCORE[@enumToInt(MIRROR_SCORE[bit])],
.b => -BISHOP_SCORE[@enumToInt(MIRROR_SCORE[bit])],
.r => -ROOK_SCORE[@enumToInt(MIRROR_SCORE[bit])],
.k => -KING_SCORE[@enumToInt(MIRROR_SCORE[bit])],
.p => -PAWN_SCORE[@intFromEnum(MIRROR_SCORE[bit])],
.n => -KNIGHT_SCORE[@intFromEnum(MIRROR_SCORE[bit])],
.b => -BISHOP_SCORE[@intFromEnum(MIRROR_SCORE[bit])],
.r => -ROOK_SCORE[@intFromEnum(MIRROR_SCORE[bit])],
.k => -KING_SCORE[@intFromEnum(MIRROR_SCORE[bit])],
return @bitCast(BoardType, self.occupancies[@enumToInt(Chess.Colors.white)]) |
@bitCast(BoardType, self.occupancies[@enumToInt(Chess.Colors.black)]);
return @bitCast(BoardType, self.occupancies[@intFromEnum(Chess.Colors.white)]) |
@bitCast(BoardType, self.occupancies[@intFromEnum(Chess.Colors.black)]);
const square = @intToEnum(Square, rank * SIZE + file);
self.occupancies[@enumToInt(Chess.Colors.white)].set(square);
const square = @enumFromInt(Square, rank * SIZE + file);
self.occupancies[@intFromEnum(Chess.Colors.white)].set(square);
'P' => self.bitboards[@enumToInt(Chess.PE.P)].set(square),
'N' => self.bitboards[@enumToInt(Chess.PE.N)].set(square),
'B' => self.bitboards[@enumToInt(Chess.PE.B)].set(square),
'R' => self.bitboards[@enumToInt(Chess.PE.R)].set(square),
'Q' => self.bitboards[@enumToInt(Chess.PE.Q)].set(square),
'K' => self.bitboards[@enumToInt(Chess.PE.K)].set(square),
'P' => self.bitboards[@intFromEnum(Chess.PE.P)].set(square),
'N' => self.bitboards[@intFromEnum(Chess.PE.N)].set(square),
'B' => self.bitboards[@intFromEnum(Chess.PE.B)].set(square),
'R' => self.bitboards[@intFromEnum(Chess.PE.R)].set(square),
'Q' => self.bitboards[@intFromEnum(Chess.PE.Q)].set(square),
'K' => self.bitboards[@intFromEnum(Chess.PE.K)].set(square),
const square = @intToEnum(Square, rank * SIZE + file);
self.occupancies[@enumToInt(Chess.Colors.black)].set(square);
const square = @enumFromInt(Square, rank * SIZE + file);
self.occupancies[@intFromEnum(Chess.Colors.black)].set(square);
'p' => self.bitboards[@enumToInt(Chess.PE.p)].set(square),
'n' => self.bitboards[@enumToInt(Chess.PE.n)].set(square),
'b' => self.bitboards[@enumToInt(Chess.PE.b)].set(square),
'r' => self.bitboards[@enumToInt(Chess.PE.r)].set(square),
'q' => self.bitboards[@enumToInt(Chess.PE.q)].set(square),
'k' => self.bitboards[@enumToInt(Chess.PE.k)].set(square),
'p' => self.bitboards[@intFromEnum(Chess.PE.p)].set(square),
'n' => self.bitboards[@intFromEnum(Chess.PE.n)].set(square),
'b' => self.bitboards[@intFromEnum(Chess.PE.b)].set(square),
'r' => self.bitboards[@intFromEnum(Chess.PE.r)].set(square),
'q' => self.bitboards[@intFromEnum(Chess.PE.q)].set(square),
'k' => self.bitboards[@intFromEnum(Chess.PE.k)].set(square),
const pa = self.attacks.pawn_attacks[@enumToInt(Chess.Colors.black)][square];
if (pa & @bitCast(BoardType, self.bitboards[@enumToInt(Chess.PE.P)]) != 0) return true;
const pa = self.attacks.pawn_attacks[@intFromEnum(Chess.Colors.black)][square];
if (pa & @bitCast(BoardType, self.bitboards[@intFromEnum(Chess.PE.P)]) != 0) return true;
const pa = self.attacks.pawn_attacks[@enumToInt(Chess.Colors.white)][square];
if (pa & @bitCast(BoardType, self.bitboards[@enumToInt(Chess.PE.p)]) != 0) return true;
const pa = self.attacks.pawn_attacks[@intFromEnum(Chess.Colors.white)][square];
if (pa & @bitCast(BoardType, self.bitboards[@intFromEnum(Chess.PE.p)]) != 0) return true;
.white => source_square >= @enumToInt(Square.a7) and
source_square <= @enumToInt(Square.h7),
.black => source_square >= @enumToInt(Square.a2) and
source_square <= @enumToInt(Square.h2),
.white => source_square >= @intFromEnum(Square.a7) and
source_square <= @intFromEnum(Square.h7),
.black => source_square >= @intFromEnum(Square.a2) and
source_square <= @intFromEnum(Square.h2),
self.attacks.pawn_attacks[@enumToInt(self.side)][source_square] &
@bitCast(BoardType, self.occupancies[@enumToInt(self.side.enemy())]);
self.attacks.pawn_attacks[@intFromEnum(self.side)][source_square] &
@bitCast(BoardType, self.occupancies[@intFromEnum(self.side.enemy())]);
const enpassant_attacks = self.attacks.pawn_attacks[@enumToInt(self.side)][source_square] &
@as(BoardType, 1) << @enumToInt(self.enpassant.?);
const enpassant_attacks = self.attacks.pawn_attacks[@intFromEnum(self.side)][source_square] &
@as(BoardType, 1) << @intFromEnum(self.enpassant.?);
.source = @intToEnum(Square, source_square),
.target = @intToEnum(Square, target_enpassant),
.source = @enumFromInt(Square, source_square),
.target = @enumFromInt(Square, target_enpassant),
self.hash ^= zobrist.piece_hashes[@enumToInt(move.piece)][@enumToInt(move.source)];
self.hash ^= zobrist.piece_hashes[@enumToInt(move.piece)][@enumToInt(move.target)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(move.piece)][@intFromEnum(move.source)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(move.piece)][@intFromEnum(move.target)];
self.hash ^= zobrist.piece_hashes[@enumToInt(move.piece)][@enumToInt(move.target)];
self.hash ^= zobrist.piece_hashes[@enumToInt(move.prom)][@enumToInt(move.target)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(move.piece)][@intFromEnum(move.target)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(move.prom)][@intFromEnum(move.target)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.R)][@enumToInt(Square.h1)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.R)][@enumToInt(Square.f1)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.R)][@intFromEnum(Square.h1)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.R)][@intFromEnum(Square.f1)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.R)][@enumToInt(Square.a1)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.R)][@enumToInt(Square.d1)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.R)][@intFromEnum(Square.a1)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.R)][@intFromEnum(Square.d1)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.r)][@enumToInt(Square.h8)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.r)][@enumToInt(Square.f8)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.r)][@intFromEnum(Square.h8)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.r)][@intFromEnum(Square.f8)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.r)][@enumToInt(Square.a8)];
self.hash ^= zobrist.piece_hashes[@enumToInt(Chess.PE.r)][@enumToInt(Square.d8)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.r)][@intFromEnum(Square.a8)];
self.hash ^= zobrist.piece_hashes[@intFromEnum(Chess.PE.r)][@intFromEnum(Square.d8)];
self.occupancies[@enumToInt(Chess.Colors.white)] = @bitCast(BitBoard, white);
self.occupancies[@enumToInt(Chess.Colors.black)] = @bitCast(BitBoard, black);
self.occupancies[@intFromEnum(Chess.Colors.white)] = @bitCast(BitBoard, white);
self.occupancies[@intFromEnum(Chess.Colors.black)] = @bitCast(BitBoard, black);
const exe = b.addExecutable("pistike", "src/main.zig");
const exe = b.addExecutable(std.build.ExecutableOptions{
.name = "pistike",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});