fen: rule50 赋值但暂时未正常工作

按 Stockfish 的写法:
  ss << (" - ")
     << st->rule50 << " " << 1 + (gamePly - (sideToMove == BLACK)) / 2;

最后一节并非如 http://www.xqbase.com/protocol/pgnfen2.htm 所说的,
回合数(Fullmove number) 棕色那段
当前要进行到的回合数。不管白还是黑,第一步时总是以1表示,
以后黑方每走一步数字就加1。

原因待查。目前也未正常工作。
This commit is contained in:
Calcitem 2020-09-05 17:13:37 +08:00
parent 93dd3ba971
commit b379588655
2 changed files with 6 additions and 10 deletions

View File

@ -370,15 +370,7 @@ const string Position::fen() const
ss << " ";
// http://www.xqbase.com/protocol/pgnfen2.htm
// Halfmove clock
ss << st->rule50;
//ss << " ";
// Fullmove number
//ss << moveStep;
ss << st->rule50 << " " << 1 + (gamePly - (sideToMove == BLACK)) / 2;
return ss.str();
}
@ -390,10 +382,14 @@ const string Position::fen() const
bool Position::do_move(Move m)
{
++st->rule50;
MoveType mt = type_of(m);
switch (mt) {
case MOVETYPE_REMOVE:
// Reset rule 50 counter
st->rule50 = 0;
return remove_piece(static_cast<Square>(-m));
case MOVETYPE_MOVE:
return move_piece(from_sq(m), to_sq(m));

View File

@ -193,7 +193,7 @@ public:
int pieceCountInHand[COLOR_NB]{ 0 };
int pieceCountOnBoard[COLOR_NB]{ 0 };
int pieceCountNeedRemove{ 0 };
int gamePly;
int gamePly { 0 };
Color sideToMove { NOCOLOR };
Thread *thisThread;
StateInfo *st;