88#include < cstddef>
99#include < ostream>
1010#include < vector>
11- #include < log4cplus/logger.h>
12- #include < log4cplus/loggingmacros.h>
11+ #include < spdlog/spdlog.h>
1312
1413#include " ../def.h"
1514#include " ../math/bitset_util.h"
@@ -62,6 +61,7 @@ class FullBoard : private Board<BOARD_LEN> {
6261 black_pieces_count_(0 ),
6362 hash_key_(0 ) {}
6463 ~FullBoard () = default ;
64+ DISALLOW_COPY_AND_ASSIGN (FullBoard);
6565 void Init ();
6666 void Copy (const FullBoard &b);
6767
@@ -101,7 +101,7 @@ class FullBoard : private Board<BOARD_LEN> {
101101 private:
102102 typedef std::vector<PositionIndex> PointIndxVector;
103103
104- static log4cplus::Logger logger_;
104+ static std::shared_ptr<spdlog::logger> logger_;
105105
106106 piece_structure::ChainSet<BOARD_LEN> chain_sets_[2 ];
107107 std::array<BitSet<BOARD_LEN>, 2 > playable_states_array_;
@@ -145,8 +145,6 @@ class FullBoard : private Board<BOARD_LEN> {
145145
146146 std::string PlayableStatesToString () const ;
147147 std::string EyeStatesToString () const ;
148-
149- DISALLOW_COPY_AND_ASSIGN_AND_MOVE (FullBoard)
150148};
151149
152150template <BoardLen BOARD_LEN>
@@ -165,8 +163,8 @@ void Play(FullBoard<BOARD_LEN> *full_board, PositionIndex position_index) {
165163}
166164
167165template <BoardLen BOARD_LEN>
168- log4cplus::Logger FullBoard<BOARD_LEN>::logger_ =
169- log4cplus::Logger::getInstance (" foolgo.board.FullBoard" );
166+ std::shared_ptr<spdlog::logger> FullBoard<BOARD_LEN>::logger_ =
167+ spdlog::stdout_logger_st (" foolgo.board.FullBoard" );
170168
171169template <BoardLen BOARD_LEN>
172170bool FullBoard<BOARD_LEN>::IsEnd() const {
@@ -288,8 +286,8 @@ void FullBoard<BOARD_LEN>::PlayMove(const Move &move) {
288286 ForceAndPositionIndex (move_force, adjacent_index));
289287 }
290288
291- LOG4CPLUS_DEBUG ( logger_, " after modify adjacent eyes state - *this:" <<
292- ToString (false ));
289+ logger_-> debug ( " after modify adjacent eyes state - *this:{} " ,
290+ ToString (false ));
293291
294292 // Modify adjacent real eyes state.
295293 for (int i = 0 ; i < 4 ; ++i) {
@@ -311,8 +309,8 @@ void FullBoard<BOARD_LEN>::PlayMove(const Move &move) {
311309// }
312310 }
313311
314- LOG4CPLUS_DEBUG ( logger_, " after modify adjacent real eyes state - *this:" <<
315- ToString (false ));
312+ logger_-> debug ( " after modify adjacent real eyes state - *this:{} " ,
313+ ToString (false ));
316314
317315 // Modify Oblique real eyes state.
318316 for (int i = 0 ; i < 4 ; ++i) {
@@ -332,17 +330,17 @@ void FullBoard<BOARD_LEN>::PlayMove(const Move &move) {
332330 }
333331 }
334332
335- LOG4CPLUS_DEBUG ( logger_, " after modify oblique real eyes state - *this:" <<
336- ToString (false ));
333+ logger_-> debug ( " after modify oblique real eyes state - *this:{} " ,
334+ ToString (false ));
337335
338336 // The playable state of adjacent positions of the chains, which is adjacent
339337 // to ate pieces, should be modified.
340338 for (int i = 0 ; i < 4 ; ++i) {
341339 ModifyAtePiecesAdjacentChains (ate_piece_indexes_array[i], opposite_force);
342340 }
343341
344- LOG4CPLUS_DEBUG ( logger_, " after modify ate pieces adjacent chains - *this:"
345- << ToString (false ));
342+ logger_-> debug ( " after modify ate pieces adjacent chains - *this:" ,
343+ ToString (false ));
346344
347345 ko_indx_ = FullBoard<BOARD_LEN>::NONE;
348346 PositionIndex single_ate_piece_index = FullBoard<BOARD_LEN>::NONE;
@@ -529,7 +527,7 @@ void FullBoard<BOARD_LEN>::PlayBasicMove(
529527 chain_sets_[move_force].AddPiece (move_index, air_set);
530528
531529 if (chain_sets_[move_force].GetAirCount (move_index) == 0 ) {
532- LOG4CPLUS_DEBUG ( logger_, " air count is zero!" );
530+ logger_-> debug ( " air count is zero!" );
533531 *suicided_pieces_indexes = RemoveChain (move);
534532 }
535533}
@@ -628,15 +626,15 @@ void FullBoard<BOARD_LEN>::ModifyRealEyesState(
628626 }
629627 }
630628
631- LOG4CPLUS_DEBUG ( logger_, " piece_or_eye_count:" << piece_or_eye_count);
629+ logger_-> debug ( " piece_or_eye_count:{} " , piece_or_eye_count);
632630
633631 static const PositionIndex TABLE[3 ] = { 3 , 2 , 1 };
634632 auto state = calculator.CentralOrEdgeOrCorner (position);
635633 if (TABLE[state] <= piece_or_eye_count) {
636- LOG4CPLUS_DEBUG ( logger_, " is real eye" );
634+ logger_-> debug ( " is real eye" );
637635 SetRealEyeAsTrue (ForceAndPositionIndex (force, indx));
638636 } else {
639- LOG4CPLUS_DEBUG ( logger_, " is not real eye" );
637+ logger_-> debug ( " is not real eye" );
640638 playable_states_array_[force].set (indx);
641639 playable_states_array_[OppositeForce (force)].set (indx);
642640 }
0 commit comments