@@ -798,92 +798,6 @@ bool Search::ProbeHash(TEntry & hentry)
798798 return TTable::instance ().retrieve (hash, hentry);
799799}
800800
801- #if defined (SYZYGY_SUPPORT)
802- Move Search::tableBaseRootSearch ()
803- {
804- if (!TB_LARGEST || countBits (m_position.BitsAll ()) > TB_LARGEST)
805- return 0 ;
806-
807- auto result =
808- tb_probe_root (m_position.BitsAll (WHITE), m_position.BitsAll (BLACK),
809- m_position.Bits (KW) | m_position.Bits (KB),
810- m_position.Bits (QW) | m_position.Bits (QB),
811- m_position.Bits (RW) | m_position.Bits (RB),
812- m_position.Bits (BW) | m_position.Bits (BB),
813- m_position.Bits (NW) | m_position.Bits (NB),
814- m_position.Bits (PW) | m_position.Bits (PB),
815- m_position.Fifty (),
816- m_position.CanCastle (m_position.Side (), KINGSIDE) || m_position.CanCastle (m_position.Side (), QUEENSIDE),
817- 0 ,
818- m_position.Side () == WHITE, nullptr );
819-
820- //
821- // Validate result of a probe, if uncertain, return 0 and fallback to igel's main search at root
822- //
823-
824- if (result == TB_RESULT_FAILED || result == TB_RESULT_CHECKMATE || result == TB_RESULT_STALEMATE)
825- return 0 ;
826-
827- //
828- // Different board representation
829- //
830-
831- auto to = abs (int (TB_GET_TO (result)) - 63 );
832- auto from = abs (int (TB_GET_FROM (result)) - 63 );
833- auto promoted = TB_GET_PROMOTES (result);
834- auto ep = TB_GET_EP (result);
835-
836- Move tableBaseMove;
837-
838- assert (!ep);
839-
840- PIECE piece = m_position[from];
841- PIECE capture = m_position[to];
842-
843- if (!promoted && !ep)
844- tableBaseMove = Move (from, to, piece, capture);
845- else {
846- switch (promoted)
847- {
848- case TB_PROMOTES_QUEEN:
849- tableBaseMove = Move (from, to, m_position[from], capture, QW | m_position.Side ());
850- break ;
851- case TB_PROMOTES_ROOK:
852- tableBaseMove = Move (from, to, m_position[from], capture, RW | m_position.Side ());
853- break ;
854- case TB_PROMOTES_BISHOP:
855- tableBaseMove = Move (from, to, m_position[from], capture, BW | m_position.Side ());
856- break ;
857- case TB_PROMOTES_KNIGHT:
858- tableBaseMove = Move (from, to, m_position[from], capture, NW | m_position.Side ());
859- break ;
860- default :
861- assert (false );
862- break ;
863- }
864- }
865-
866- //
867- // Sanity check, make sure move generated by tablebase probe is a valid one
868- //
869-
870- MoveList moves;
871- if (m_position.InCheck ())
872- GenMovesInCheck (m_position, moves);
873- else
874- GenAllMoves (m_position, moves);
875-
876- auto mvSize = moves.Size ();
877- for (size_t i = 0 ; i < mvSize; ++i) {
878- if (moves[i].m_mv == tableBaseMove)
879- return tableBaseMove;
880- }
881-
882- assert (false );
883- return 0 ;
884- }
885- #endif
886-
887801void Search::startWorkerThreads (Time time)
888802{
889803 for (unsigned int i = 0 ; i < m_thc; ++i) {
@@ -1006,39 +920,6 @@ uint64_t Search::startSearch(Time time, int depth, bool ponderSearch, bool bench
1006920 std::cout << std::endl;
1007921 };
1008922
1009- if (m_principalSearcher) {
1010-
1011- //
1012- // Check if game is over
1013- //
1014-
1015- std::string result, comment;
1016- int legalMoves = 0 ;
1017- Move onlyMove {};
1018- if (isGameOver (m_position, result, comment, onlyMove, legalMoves)) {
1019- waitUntilCompletion ();
1020- std::cout << result << " " << comment << std::endl << std::endl;
1021- printBestMove (this , m_position, onlyMove, m_ponder);
1022- return 0 ;
1023- }
1024-
1025- #if defined (SYZYGY_SUPPORT)
1026- //
1027- // Probe tablebases/tt at root
1028- //
1029-
1030- auto bestTb = tableBaseRootSearch ();
1031-
1032- if (bestTb) {
1033- waitUntilCompletion ();
1034- printBestMove (this , m_position, bestTb, m_ponder);
1035- return 1 ;
1036- }
1037- #endif
1038-
1039- m_best = onlyMove; // set best move to first legal move in case we are low on time
1040- }
1041-
1042923 //
1043924 // Perform search for a best move
1044925 //
0 commit comments