Z4PX3GURAMMW55R5KRP5WCO2CXFEI6LBULGBQRYTABBONCOZ5NHQC
V34YWVR66ERHUV6SOYQWJQLYMPLWEIJDXCR44B3SLPN2CRYIR45QC
RNEXG5IFDKMHSUR6RMNTI3Y32ORLVMZ6UJYKHLV2XBMT2QONBTVQC
2TRWSYAHRLVT2V6FGRNHKYQZKFDCMKMJOI2G3HYMOVLSJMGSBFDQC
HNCUAGWTMX3UHH2KFTUM3M6Q4CC33M6PVE5DWZWFG5UM2Y7J2ZKAC
WAJ2J7G4QZE4LLGGZNIQ3ZIBCR3CSFOH3V2NIK2JQPALFHARRNMAC
I4AKZYZM5LOD7SNZRNWY34KWOHE34QPEWO6TIGHYMJACXOJKBMPQC
3N3FYEBBZ6RLFCFKG2FNHHRDUZBOVBAAXAHBUPSOB3FN5HMWLVDAC
const king = switch (gs.side) {
.white => @intCast(SquareType, @ctz(@bitCast(BoardType, gs.bitboards[@enumToInt(Chess.PE.K)]))),
.black => @intCast(SquareType, @ctz(@bitCast(BoardType, gs.bitboards[@enumToInt(Chess.PE.k)]))),
};
var in_check = gs.isSquareAttacked(king, gs.side.enemy());
// NULL move pruning
{
if (depth >= 3 and !in_check and gs.ply != 0) {
// backup board state
var bck: GameState = undefined;
gs.backup(&bck);
// prepare GameState
gs.side = gs.side.enemy();
gs.enpassant = null;
const s = -try negamax(gs, -beta, -beta + 1, depth - 1 - NULL_REDUCTION);
gs.restore(&bck);
if (s >= beta) {
return beta;
}
}
}
- [NULL move pruning](https://web.archive.org/web/20071031095933/http://www.brucemo.com/compchess/programming/nullmove.htm)
- TODO: see comment below the [video](https://www.youtube.com/watch?v=n6xAzopULxU&list=PLmN0neTso3Jxh8ZIylk74JpwfiWNI76Cs&index=63), this is not a perfect solution