32
32
namespace lczero {
33
33
34
34
Position::Position (const Position& parent, Move m)
35
- : no_capture_ply_ (parent.no_capture_ply_ + 1 ),
35
+ : rule50_ply_ (parent.rule50_ply_ + 1 ),
36
36
ply_count_ (parent.ply_count_ + 1 ) {
37
37
them_board_ = parent.us_board_ ;
38
- const bool capture = them_board_.ApplyMove (m);
38
+ const bool is_zeroing = them_board_.ApplyMove (m);
39
39
us_board_ = them_board_;
40
40
us_board_.Mirror ();
41
- if (capture) no_capture_ply_ = 0 ;
41
+ if (is_zeroing) rule50_ply_ = 0 ;
42
42
}
43
43
44
- Position::Position (const ChessBoard& board, int no_capture_ply , int game_ply)
45
- : no_capture_ply_(no_capture_ply ), repetitions_(0 ), ply_count_(game_ply) {
44
+ Position::Position (const ChessBoard& board, int rule50_ply , int game_ply)
45
+ : rule50_ply_(rule50_ply ), repetitions_(0 ), ply_count_(game_ply) {
46
46
us_board_ = board;
47
47
them_board_ = board;
48
48
them_board_.Mirror ();
@@ -67,17 +67,17 @@ GameResult PositionHistory::ComputeGameResult() const {
67
67
}
68
68
69
69
if (!board.HasMatingMaterial ()) return GameResult::DRAW;
70
- if (Last ().GetNoCaptureNoPawnPly () >= 100 ) return GameResult::DRAW;
70
+ if (Last ().GetRule50Ply () >= 100 ) return GameResult::DRAW;
71
71
if (Last ().GetGamePly () >= 450 ) return GameResult::DRAW;
72
72
if (Last ().GetRepetitions () >= 2 ) return GameResult::DRAW;
73
73
74
74
return GameResult::UNDECIDED;
75
75
}
76
76
77
- void PositionHistory::Reset (const ChessBoard& board, int no_capture_ply ,
77
+ void PositionHistory::Reset (const ChessBoard& board, int rule50_ply ,
78
78
int game_ply) {
79
79
positions_.clear ();
80
- positions_.emplace_back (board, no_capture_ply , game_ply);
80
+ positions_.emplace_back (board, rule50_ply , game_ply);
81
81
}
82
82
83
83
void PositionHistory::Append (Move m) {
@@ -91,14 +91,14 @@ void PositionHistory::Append(Move m) {
91
91
int PositionHistory::ComputeLastMoveRepetitions () const {
92
92
const auto & last = positions_.back ();
93
93
// TODO(crem) implement hash/cache based solution.
94
- if (last.GetNoCaptureNoPawnPly () < 4 ) return 0 ;
94
+ if (last.GetRule50Ply () < 4 ) return 0 ;
95
95
96
96
for (int idx = positions_.size () - 3 ; idx >= 0 ; idx -= 2 ) {
97
97
const auto & pos = positions_[idx];
98
98
if (pos.GetBoard () == last.GetBoard ()) {
99
99
return 1 + pos.GetRepetitions ();
100
100
}
101
- if (pos.GetNoCaptureNoPawnPly () < 2 ) return 0 ;
101
+ if (pos.GetRule50Ply () < 2 ) return 0 ;
102
102
}
103
103
return 0 ;
104
104
}
@@ -107,7 +107,7 @@ bool PositionHistory::DidRepeatSinceLastZeroingMove() const {
107
107
for (auto iter = positions_.rbegin (), end = positions_.rend (); iter != end;
108
108
++iter) {
109
109
if (iter->GetRepetitions () > 0 ) return true ;
110
- if (iter->GetNoCaptureNoPawnPly () == 0 ) return false ;
110
+ if (iter->GetRule50Ply () == 0 ) return false ;
111
111
}
112
112
return false ;
113
113
}
@@ -119,7 +119,7 @@ uint64_t PositionHistory::HashLast(int positions) const {
119
119
if (!positions--) break ;
120
120
hash = HashCat (hash, iter->Hash ());
121
121
}
122
- return HashCat (hash, Last ().GetNoCaptureNoPawnPly ());
122
+ return HashCat (hash, Last ().GetRule50Ply ());
123
123
}
124
124
125
125
} // namespace lczero
0 commit comments