parent
1e29418e2c
commit
e1f066bbfc
|
@ -138,6 +138,9 @@ inline int H2(Key h)
|
||||||
Key cuckoo[8192];
|
Key cuckoo[8192];
|
||||||
Move cuckooMove[8192];
|
Move cuckooMove[8192];
|
||||||
|
|
||||||
|
/// Position::init() initializes at startup the various arrays used to compute
|
||||||
|
/// hash keys.
|
||||||
|
|
||||||
void Position::init()
|
void Position::init()
|
||||||
{
|
{
|
||||||
PRNG rng(1070372);
|
PRNG rng(1070372);
|
||||||
|
@ -220,29 +223,37 @@ Position &Position::set(const string &fenStr, StateInfo *si, Thread *th)
|
||||||
ss >> std::noskipws;
|
ss >> std::noskipws;
|
||||||
|
|
||||||
// 1. Piece placement
|
// 1. Piece placement
|
||||||
// TODO
|
|
||||||
#if 0
|
|
||||||
while ((ss >> token) && !isspace(token)) {
|
while ((ss >> token) && !isspace(token)) {
|
||||||
if (token == '@')
|
if (token == '@' || token == 'O' || token == 'X') {
|
||||||
sq += (token - '0') * EAST; // Advance the given number of files
|
// put_piece(Piece(idx), sq); // TODO
|
||||||
|
|
||||||
else if (token == '/')
|
|
||||||
sq += 2 * SOUTH;
|
|
||||||
|
|
||||||
else if ((idx = PieceToChar.find(token)) != string::npos) {
|
|
||||||
put_piece(Piece(idx), sq);
|
|
||||||
++sq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++sq;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// 2. Active color
|
// 2. Active color
|
||||||
ss >> token;
|
ss >> token;
|
||||||
sideToMove = (token == 'w' ? WHITE : BLACK);
|
sideToMove = (token == 'b' ? BLACK : WHITE);
|
||||||
ss >> token;
|
|
||||||
|
|
||||||
// 3. Phrase
|
// 3. Phrase
|
||||||
|
ss >> token;
|
||||||
|
|
||||||
|
switch (token) {
|
||||||
|
case 'r':
|
||||||
|
phase = PHASE_READY;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
phase = PHASE_PLACING;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
phase = PHASE_MOVING;
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
phase = PHASE_GAMEOVER;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
phase = PHASE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
// 4-5. Halfmove clock and fullmove number
|
// 4-5. Halfmove clock and fullmove number
|
||||||
ss >> std::skipws >> st->rule50 >> gamePly;
|
ss >> std::skipws >> st->rule50 >> gamePly;
|
||||||
|
@ -254,7 +265,7 @@ Position &Position::set(const string &fenStr, StateInfo *si, Thread *th)
|
||||||
thisThread = th;
|
thisThread = th;
|
||||||
set_state(st);
|
set_state(st);
|
||||||
|
|
||||||
//assert(pos_is_ok());
|
assert(pos_is_ok());
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -2033,3 +2044,13 @@ void Position::print_board()
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Position::pos_is_ok() performs some consistency checks for the
|
||||||
|
/// position object and raises an asserts if something wrong is detected.
|
||||||
|
/// This is meant to be helpful when debugging.
|
||||||
|
|
||||||
|
bool Position::pos_is_ok() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue