This commit is contained in:
Calcitem 2021-05-01 20:40:39 +08:00
parent 4ae863d24c
commit 2d6a23573a
14 changed files with 13 additions and 99 deletions

View File

@ -24,9 +24,6 @@ uint8_t PopCnt16[1 << 16];
Bitboard SquareBB[SQ_32];
Bitboard StarSquareBB9;
Bitboard StarSquareBB12;
/// Bitboards::pretty() returns an ASCII representation of a bitboard suitable
/// to be printed to standard output. Useful for debugging.
@ -57,7 +54,4 @@ void Bitboards::init()
for (Square s = SQ_BEGIN; s < SQ_END; ++s)
SquareBB[s] = (1UL << s);
StarSquareBB9 = S4(16, 18, 20, 22);
StarSquareBB12 = S4(17, 19, 21, 23);
}

View File

@ -69,15 +69,6 @@ inline Bitboard square_bb(Square s) noexcept
return SquareBB[s];
}
inline Bitboard star_square_bb_9() noexcept
{
return StarSquareBB9;
}
inline Bitboard star_square_bb_12() noexcept
{
return StarSquareBB12;
}
/// Overloads of bitwise operators between a Bitboard and a Square for testing
/// whether a given bit is set in a bitboard, and for setting and clearing bits.

View File

@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstring>
#include <random>
#include "bitboard.h"

View File

@ -16,16 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
#include <random>
#include <array>
#include <cstring>
#include "movegen.h"
#include "position.h"
#include "misc.h"
#include "bitboard.h"
#include "option.h"
#include "mills.h"
/// generate<PLACE> generates all places.
@ -44,7 +36,7 @@ ExtMove *generate<PLACE>(Position &pos, ExtMove *moveList)
return cur;
}
/// generate<PLACE> generates all places.
/// generate<MOVE> generates all moves.
/// Returns a pointer to the end of the move moves.
template<>
ExtMove *generate<MOVE>(Position &pos, ExtMove *moveList)
@ -81,7 +73,7 @@ ExtMove *generate<MOVE>(Position &pos, ExtMove *moveList)
return cur;
}
/// generate<PLACE> generates all removes.
/// generate<REMOVE> generates all removes.
/// Returns a pointer to the end of the move moves.
template<>
ExtMove *generate<REMOVE>(Position &pos, ExtMove *moveList)
@ -145,7 +137,7 @@ ExtMove *generate<LEGAL>(Position &pos, ExtMove *moveList)
default:
#ifdef FLUTTER_UI
LOGD("generate(): action = %d\n", pos.get_action());
LOGD("generate(): action = %hu\n", pos.get_action());
#endif
assert(0);
break;

View File

@ -16,8 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
#include "movepick.h"
// partial_insertion_sort() sorts moves in descending order up to and including
@ -34,11 +32,7 @@ void partial_insertion_sort(ExtMove *begin, const ExtMove *end, int limit)
}
}
/// Constructors of the MovePicker class. As arguments we pass information
/// to help it to return the (presumably) good moves first, to decide which
/// moves to return (in the quiescence search, for instance, we only want to
/// search captures, promotions, and some checks) and how important good move
/// ordering is at the current node.
/// Constructors of the MovePicker class.
/// MovePicker constructor for the main search
MovePicker::MovePicker(Position &p) noexcept

View File

@ -16,23 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <cassert>
#include <cstddef> // For offsetof()
#include <cstring> // For std::memset, std::memcmp
#include <iomanip>
#include <sstream>
#include "bitboard.h"
#include "misc.h"
#include "movegen.h"
#include "position.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
#include "option.h"
#include "rule.h"
#include "mills.h"
using std::string;

View File

@ -19,7 +19,6 @@
#include <cstring>
#include "rule.h"
#include "types.h"
struct Rule rule = {
"打三棋(12连棋)", // 打三棋

View File

@ -16,29 +16,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring> // For std::memset
#include <iostream>
#include <sstream>
#include "evaluate.h"
#include "misc.h"
#include "movegen.h"
#include "movepick.h"
#include "position.h"
#include "search.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
//#include "uci.h"
#include "endgame.h"
#include "types.h"
#include "option.h"
#include <random>
using std::string;
using Eval::evaluate;
using namespace Search;
@ -49,7 +33,7 @@ Value search(Position *pos, Sanmill::Stack<Position> &ss, Depth depth, Depth ori
bool is_timeout(TimePoint startTime);
/// Search::init() is called at startup to initialize various lookup tables
/// Search::init() is called at startup
void Search::init() noexcept
{
@ -437,7 +421,7 @@ Value search(Position *pos, Sanmill::Stack<Position> &ss, Depth depth, Depth ori
// Check for a new best move
// Finished searching the move. If a stop occurred, the return value of
// the search cannot be trusted, and we return immediately without
// updating best move, PV and TT.
// updating best move and TT.
if (Threads.stop.load(std::memory_order_relaxed))
return VALUE_ZERO;

View File

@ -21,11 +21,7 @@
#include <vector>
#include "stack.h"
#include "tt.h"
#include "endgame.h"
#include "movepick.h"
#include "types.h"
#ifdef CYCLE_STAT
#include "stopwatch.h"

View File

@ -19,9 +19,6 @@
#ifndef STACK_H
#define STACK_H
#include <cstdlib>
#include <cassert>
namespace Sanmill
{

View File

@ -16,15 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
#include <algorithm> // For std::count
#include <iomanip>
#include "movegen.h"
#include "search.h"
#include "thread.h"
#include "uci.h"
#include "tt.h"
#include "option.h"
#include "mills.h"
@ -84,7 +79,7 @@ Thread::~Thread()
void Thread::clear() noexcept
{
// TODO: Do nothing
// TODO: Reset histories
return;
}
@ -549,11 +544,7 @@ void ThreadPool::start_thinking(Position *pos, bool ponderMode)
increaseDepth = true;
main()->ponder = ponderMode;
// We use Position::set() to set root position across threads. But there are
// some StateInfo fields (previous, pliesFromNull, capturedPiece) that cannot
// be deduced from a fen string, so set() clears them and they are set from
// setupStates->back() later. The rootState is per thread, earlier states are shared
// since they are read-only.
// We use Position::set() to set root position across threads.
for (Thread *th : *this) {
th->rootPos = pos;
}

View File

@ -20,7 +20,7 @@
#ifdef TRANSPOSITION_TABLE_ENABLE
static constexpr int TRANSPOSITION_TABLE_SIZE = 0x1000000; // 8-128M:102s, 4-64M:93s 2-32M:91s 1-16M: 冲突
static constexpr int TRANSPOSITION_TABLE_SIZE = 0x1000000;
HashMap<Key, TTEntry> TT(TRANSPOSITION_TABLE_SIZE);
#ifdef TRANSPOSITION_TABLE_FAKE_CLEAN

View File

@ -16,19 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include "evaluate.h"
#include "movegen.h"
#include "position.h"
#include "search.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
#include "rule.h"
#ifdef FLUTTER_UI
#include "command_channel.h"

View File

@ -16,15 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <cassert>
#include <ostream>
#include <sstream>
#include "misc.h"
#include "search.h"
//#include "misc.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
#include "option.h"