X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmove.h;h=a40c058e31c869227faf1c49353bf969ca264cf8;hb=6235904898c67e0609ba06dc9f92e1f7325dd176;hp=765328713a7201d4a49770752b5fe86b805d8693;hpb=a4a0ffce711962c0b04b35998c3c06491be373bf;p=stockfish diff --git a/src/move.h b/src/move.h index 76532871..a40c058e 100644 --- a/src/move.h +++ b/src/move.h @@ -31,6 +31,8 @@ #include "piece.h" #include "square.h" +// Maximum number of allowed moves per position +const int MOVES_MAX = 256; //// //// Types @@ -62,8 +64,7 @@ struct MoveStack { int score; }; -// Note that operator< is set up such that sorting will be in descending order -inline bool operator<(const MoveStack& f, const MoveStack& s) { return s.score < f.score; } +inline bool operator<(const MoveStack& f, const MoveStack& s) { return f.score < s.score; } // An helper insertion sort implementation template @@ -77,10 +78,10 @@ inline void insertion_sort(T* firstMove, T* lastMove) { p = d = cur; value = *p--; - if (value < *p) + if (*p < value) { do *d = *p; - while (--d != firstMove && value < *--p); + while (--d != firstMove && *--p < value); *d = value; } } @@ -130,7 +131,7 @@ inline T pick_best(T* curMove, T* lastMove) bestMove = *curMove; while (++curMove != lastMove) { - if (*curMove < bestMove) + if (bestMove < *curMove) { tmp = *curMove; *curMove = bestMove; @@ -201,9 +202,9 @@ inline Move make_ep_move(Square from, Square to) { //// Prototypes //// -extern std::ostream& operator<<(std::ostream &os, Move m); -extern Move move_from_string(const Position &pos, const std::string &str); -extern const std::string move_to_string(Move m); +extern std::ostream& operator<<(std::ostream& os, Move m); +extern Move move_from_uci(const Position& pos, const std::string &str); +extern const std::string move_to_uci(Move m, bool chess960); extern bool move_is_ok(Move m);