bitboardの引き算
bitboarderを増やすプロジェクトがあるらしいので。
inline BitBoard operator - (const BitBoard &right) const { BitBoard t; t.bb[0]=bb[0]&(~right.bb[0]); t.bb[1]=bb[1]&(~right.bb[1]); t.bb[2]=bb[2]&(~right.bb[2]); return t; }
使用例:
// 桂馬を打って詰むかな? if(Hand(p,Knight)){ BitBoard b=((p==Black)?bb_white_knight_attack[pos]:bb_black_knight_attack[pos])-occupied; while((to=b.BitScanClear())!=-1){ if(hCanKingEscapeByDrop<op>(pos,to,((p==Black)?bb_black_knight_attack[to]:bb_white_knight_attack[to]))) continue; if(hCanCapture<op>(to)) continue; return Move(p,to,Knight,0); } }
kindergarten bitboard派も増えないかな…