mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Simplify move legality check for uncommon cases
Remove a bunch of difficult and tricky code to test legality of castle and ep moves and instead use a slower but simpler check against the list of generated legal moves. Because these moves are very rare the performance impact is small but code semplification is ver big: almost 100 lines of difficult code removed ! No functionality change. No performance change (strangely enough there is no even minimal performance regression in pgo builds but instead a slightly and unexpected increase). Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -430,7 +430,7 @@ Move Book::get_move(const Position& pos) {
|
||||
return MOVE_NONE;
|
||||
|
||||
MoveStack mlist[256];
|
||||
MoveStack* last = generate_legal_moves(pos, mlist);
|
||||
MoveStack* last = generate_moves(pos, mlist);
|
||||
for (MoveStack* cur = mlist; cur != last; cur++)
|
||||
if ((int(cur->move) & 07777) == bookMove)
|
||||
return cur->move;
|
||||
|
||||
Reference in New Issue
Block a user