mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 00:26:33 +08:00
Introduce and use struct MoveList
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -71,12 +71,9 @@ const string move_to_uci(Move m, bool chess960) {
|
||||
|
||||
Move move_from_uci(const Position& pos, const string& str) {
|
||||
|
||||
MoveStack mlist[MAX_MOVES];
|
||||
MoveStack* last = generate<MV_LEGAL>(pos, mlist);
|
||||
|
||||
for (MoveStack* cur = mlist; cur != last; cur++)
|
||||
if (str == move_to_uci(cur->move, pos.is_chess960()))
|
||||
return cur->move;
|
||||
for (MoveList<MV_LEGAL> ml(pos); !ml.end(); ++ml)
|
||||
if (str == move_to_uci(ml.move(), pos.is_chess960()))
|
||||
return ml.move();
|
||||
|
||||
return MOVE_NONE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user