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:
parent
93dd3ba971
commit
b379588655
|
@ -370,15 +370,7 @@ const string Position::fen() const
|
||||||
|
|
||||||
ss << " ";
|
ss << " ";
|
||||||
|
|
||||||
// http://www.xqbase.com/protocol/pgnfen2.htm
|
ss << st->rule50 << " " << 1 + (gamePly - (sideToMove == BLACK)) / 2;
|
||||||
|
|
||||||
// Halfmove clock
|
|
||||||
|
|
||||||
ss << st->rule50;
|
|
||||||
//ss << " ";
|
|
||||||
|
|
||||||
// Fullmove number
|
|
||||||
//ss << moveStep;
|
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
@ -390,10 +382,14 @@ const string Position::fen() const
|
||||||
|
|
||||||
bool Position::do_move(Move m)
|
bool Position::do_move(Move m)
|
||||||
{
|
{
|
||||||
|
++st->rule50;
|
||||||
|
|
||||||
MoveType mt = type_of(m);
|
MoveType mt = type_of(m);
|
||||||
|
|
||||||
switch (mt) {
|
switch (mt) {
|
||||||
case MOVETYPE_REMOVE:
|
case MOVETYPE_REMOVE:
|
||||||
|
// Reset rule 50 counter
|
||||||
|
st->rule50 = 0;
|
||||||
return remove_piece(static_cast<Square>(-m));
|
return remove_piece(static_cast<Square>(-m));
|
||||||
case MOVETYPE_MOVE:
|
case MOVETYPE_MOVE:
|
||||||
return move_piece(from_sq(m), to_sq(m));
|
return move_piece(from_sq(m), to_sq(m));
|
||||||
|
|
|
@ -193,7 +193,7 @@ public:
|
||||||
int pieceCountInHand[COLOR_NB]{ 0 };
|
int pieceCountInHand[COLOR_NB]{ 0 };
|
||||||
int pieceCountOnBoard[COLOR_NB]{ 0 };
|
int pieceCountOnBoard[COLOR_NB]{ 0 };
|
||||||
int pieceCountNeedRemove{ 0 };
|
int pieceCountNeedRemove{ 0 };
|
||||||
int gamePly;
|
int gamePly { 0 };
|
||||||
Color sideToMove { NOCOLOR };
|
Color sideToMove { NOCOLOR };
|
||||||
Thread *thisThread;
|
Thread *thisThread;
|
||||||
StateInfo *st;
|
StateInfo *st;
|
||||||
|
|
Loading…
Reference in New Issue