- Zobrist::exclusion = rng.rand<Key>();
-
- for (PieceType pt = PAWN; pt <= KING; ++pt)
- {
- PieceValue[MG][make_piece(BLACK, pt)] = PieceValue[MG][pt];
- PieceValue[EG][make_piece(BLACK, pt)] = PieceValue[EG][pt];
-
- Score v = make_score(PieceValue[MG][pt], PieceValue[EG][pt]);
-
- for (Square s = SQ_A1; s <= SQ_H8; ++s)
- {
- psq[WHITE][pt][ s] = (v + PSQT[pt][s]);
- psq[BLACK][pt][~s] = -(v + PSQT[pt][s]);
- }
- }
-}
-
-
-/// Position::operator=() creates a copy of 'pos' but detaching the state pointer
-/// from the source to be self-consistent and not depending on any external data.
-
-Position& Position::operator=(const Position& pos) {
-
- std::memcpy(this, &pos, sizeof(Position));
- std::memcpy(&startState, st, sizeof(StateInfo));
- st = &startState;
- nodes = 0;
-
- assert(pos_is_ok());
-
- return *this;
-}
-
-
-/// Position::clear() erases the position object to a pristine state, with an
-/// empty board, white to move, and no castling rights.
-
-void Position::clear() {
-
- std::memset(this, 0, sizeof(Position));
- startState.epSquare = SQ_NONE;
- st = &startState;
-
- for (int i = 0; i < PIECE_TYPE_NB; ++i)
- for (int j = 0; j < 16; ++j)
- pieceList[WHITE][i][j] = pieceList[BLACK][i][j] = SQ_NONE;