search/position: refactor
This commit is contained in:
parent
bb72c31a15
commit
03f66e6f65
|
@ -239,9 +239,9 @@ public:
|
|||
/*
|
||||
0x 00 00
|
||||
square1 square2
|
||||
Placing:0x00??,?? is place location
|
||||
Moving:0x__??,__ is from,?? is to
|
||||
Removing:0xFF??,?? is neg
|
||||
Placing:0x00??,?? is place location
|
||||
Moving:0x__??,__ is from,?? is to
|
||||
Removing:0xFF??,?? is neg
|
||||
|
||||
31 ----- 24 ----- 25
|
||||
| \ | / |
|
||||
|
@ -349,8 +349,27 @@ inline bool Position::remove_piece(File f, Rank r)
|
|||
return ret;
|
||||
}
|
||||
|
||||
inline bool Position::undo_move_piece(Square from, Square to)
|
||||
{
|
||||
return move_piece(to, from); // TODO
|
||||
}
|
||||
|
||||
inline bool Position::move_piece(Square from, Square to)
|
||||
{
|
||||
#if 0
|
||||
// index[from] is not updated and becomes stale. This works as long as index[]
|
||||
// is accessed just by known occupied squares.
|
||||
Piece pc = board[from];
|
||||
Bitboard fromTo = from | to;
|
||||
byTypeBB[ALL_PIECES] ^= fromTo;
|
||||
byTypeBB[type_of(pc)] ^= fromTo;
|
||||
byColorBB[color_of(pc)] ^= fromTo;
|
||||
board[from] = NO_PIECE;
|
||||
board[to] = pc;
|
||||
index[to] = index[from];
|
||||
pieceList[pc][index[to]] = to;
|
||||
#endif
|
||||
|
||||
if (select_piece(from)) {
|
||||
return put_piece(to);
|
||||
}
|
||||
|
@ -358,10 +377,6 @@ inline bool Position::move_piece(Square from, Square to)
|
|||
return false;
|
||||
}
|
||||
|
||||
inline bool Position::undo_move_piece(Square from, Square to)
|
||||
{
|
||||
return move_piece(to, from); // TODO
|
||||
}
|
||||
|
||||
/// Mill Game
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ LimitsType Limits;
|
|||
|
||||
namespace Tablebases
|
||||
{
|
||||
|
||||
int Cardinality;
|
||||
bool RootInTB;
|
||||
bool UseRule50;
|
||||
|
@ -143,7 +142,6 @@ Value search(Position &pos, Stack *ss, Value alpha, Value beta, Depth depth, boo
|
|||
template<bool Root>
|
||||
uint64_t perft(Position &pos, Depth depth)
|
||||
{
|
||||
|
||||
StateInfo st;
|
||||
uint64_t cnt, nodes = 0;
|
||||
const bool leaf = (depth == 2);
|
||||
|
@ -191,7 +189,6 @@ void Search::clear()
|
|||
|
||||
void MainThread::search()
|
||||
{
|
||||
|
||||
if (Limits.perft) {
|
||||
nodes = perft<true>(rootPos, Limits.perft);
|
||||
sync_cout << "\nNodes searched: " << nodes << "\n" << sync_endl;
|
||||
|
@ -291,7 +288,6 @@ void MainThread::search()
|
|||
|
||||
void Thread::search()
|
||||
{
|
||||
|
||||
// To allow access to (ss-7) up to (ss+2), the stack must be oversized.
|
||||
// The former is needed to allow update_continuation_histories(ss-1, ...),
|
||||
// which accesses its argument at ss-6, also near the root.
|
||||
|
|
Loading…
Reference in New Issue