44#include < cstdint>
55#include < memory>
66#include < functional>
7+ #include < vector>
78
89#include " board/position.h"
910#include " def.h"
@@ -24,41 +25,43 @@ class SgfGame : public Game<BOARD_LEN> {
2425 ~SgfGame () = default ;
2526
2627 static std::unique_ptr<SgfGame> BuildSgfGame (const GameInfo &game_info,
27- const std::function< void ( const Sample<BOARD_LEN>&)> &collect_sample = nullptr) {
28+ std::vector< Sample<BOARD_LEN>> *samples = nullptr ) {
2829 SgfPlayer<BOARD_LEN> *black_player = new SgfPlayer<BOARD_LEN>(game_info);
2930 SgfPlayer<BOARD_LEN> *white_player = new SgfPlayer<BOARD_LEN>(game_info);
3031 FullBoard<BOARD_LEN> full_board;
3132 full_board.Init ();
3233
3334 return std::unique_ptr<SgfGame>(new SgfGame<BOARD_LEN>(
34- full_board, black_player, white_player, game_info));
35+ full_board, black_player, white_player, game_info, samples ));
3536 }
3637
3738 protected:
3839 SgfGame (const FullBoard<BOARD_LEN> &full_board,
3940 Player<BOARD_LEN> *black_player,
4041 Player<BOARD_LEN> *white_player,
4142 const GameInfo &game_info,
43+ std::vector<Sample<BOARD_LEN>> *samples,
4244 bool only_log_board = true ) : Game<BOARD_LEN>(full_board, black_player,
43- white_player, only_log_board), game_info_(game_info) {}
45+ white_player, only_log_board), game_info_(game_info),
46+ samples_ (samples) {}
4447
4548 bool ShouldLog () const override {
46- return true ;
49+ return false ;
4750 }
4851
4952 void BeforePlay (PositionIndex index) override {
50- if (collect_sample_ != nullptr ) {
53+ if (samples_ != nullptr ) {
5154 Sample<BOARD_LEN> sample;
5255 sample.full_board .Copy (this ->GetFullBoard ());
5356 sample.position_index = index;
54- collect_sample_ (sample);
57+ samples_-> push_back (sample);
5558 }
5659 }
5760
5861 private:
5962 DISALLOW_COPY_AND_ASSIGN_AND_MOVE (SgfGame);
6063 GameInfo game_info_;
61- std::function< void ( const Sample<BOARD_LEN> &)> collect_sample_ ;
64+ std::vector< Sample<BOARD_LEN>> *samples_ = nullptr ;
6265};
6366
6467}
0 commit comments