@@ -38,6 +38,8 @@ namespace Napoleon
3838 int Age = 0 ;
3939
4040 std::atomic<unsigned long > node_count (0 );
41+ std::ofstream* Search::positions_dataset;
42+ bool Search::record_positions = false ;
4143
4244 // int Search::param[Parameters::MAX] = { 25 , 1 , 150 , 3, 250, 50, 6 , 3 , 2 , 500 , 250 , 5 , 3 , 5 , 4 , 2 , 1 , 2 , 9}; // original
4345 int Search::param[Parameters::MAX] = { 91 , 1 , 18 , 9 , 118 , 36 , 2 , 3 , 2 , 490 , 72 , 4 , 3 , 1 , 4 , 2 , 1 , 2 , 8 , }; // tuned
@@ -209,13 +211,17 @@ namespace Napoleon
209211 {
210212 Move move = Constants::NullMove;
211213 Move toMake = Constants::NullMove;
214+ int move_score = Constants::Unknown;
212215 int score;
213216 int temp;
214217
215218 Age = (Age + 1 ) % 64 ;
216219 score = searchRoot (searchInfo.MaxDepth (), -Constants::Infinity, Constants::Infinity, move, board);
217220 searchInfo.IncrementDepth ();
218- if (score != Constants::Unknown) toMake = move;
221+ if (score != Constants::Unknown) {
222+ toMake = move;
223+ move_score = score;
224+ }
219225
220226 while ((searchInfo.MaxDepth () < 100 && !searchInfo.TimeOver ()) || pondering)
221227 {
@@ -248,14 +254,24 @@ namespace Napoleon
248254
249255 score = temp;
250256
251- if (score != Constants::Unknown)
257+ if (score != Constants::Unknown) {
252258 toMake = move;
259+ move_score = score;
260+ }
253261
254262 searchInfo.IncrementDepth ();
255263 }
256264
257265 StopThinking ();
258266
267+ if (record_positions)
268+ {
269+ (*positions_dataset) << board.GetFen () << " ,"
270+ << board.ToCsv () << " ,"
271+ << searchInfo.MaxDepth ()-1 << " ,"
272+ << move_score << std::endl;
273+ }
274+
259275 return toMake;
260276 }
261277
0 commit comments