- memset(st, 0, sizeof(StateInfo));
- st->epSquare = SQ_NONE;
-
- memset(byColorBB, 0, sizeof(Bitboard) * 2);
- memset(byTypeBB, 0, sizeof(Bitboard) * 8);
- memset(pieceCount, 0, sizeof(int) * 2 * 8);
- memset(index, 0, sizeof(int) * 64);
-
- for (int i = 0; i < 64; i++)
- board[i] = EMPTY;
-
- for (int i = 0; i < 7; i++)
- for (int j = 0; j < 8; j++)
- pieceList[0][i][j] = pieceList[1][i][j] = SQ_NONE;
-
- sideToMove = WHITE;
- gamePly = 0;
- initialKFile = FILE_E;
- initialKRFile = FILE_H;
- initialQRFile = FILE_A;
-}
-
-
-/// Position::reset_game_ply() simply sets gamePly to 0. It is used from the
-/// UCI interface code, whenever a non-reversible move is made in a
-/// 'position fen <fen> moves m1 m2 ...' command. This makes it possible
-/// for the program to handle games of arbitrary length, as long as the GUI
-/// handles draws by the 50 move rule correctly.
-
-void Position::reset_game_ply() {
-
- gamePly = 0;
-}
-
-
-/// Position::put_piece() puts a piece on the given square of the board,
-/// updating the board array, bitboards, and piece counts.
-
-void Position::put_piece(Piece p, Square s) {
-
- Color c = color_of_piece(p);
- PieceType pt = type_of_piece(p);
-
- board[s] = p;
- index[s] = pieceCount[c][pt];
- pieceList[c][pt][index[s]] = s;
-
- set_bit(&(byTypeBB[pt]), s);
- set_bit(&(byColorBB[c]), s);
- set_bit(&byTypeBB[0], s); // HACK: byTypeBB[0] contains all occupied squares.
-
- pieceCount[c][pt]++;
-
- if (pt == KING)
- st->kingSquare[c] = s;
-}
-
-
-/// Position::allow_oo() gives the given side the right to castle kingside.
-/// Used when setting castling rights during parsing of FEN strings.
-
-void Position::allow_oo(Color c) {
-
- st->castleRights |= (1 + int(c));
-}
-
-
-/// Position::allow_ooo() gives the given side the right to castle queenside.
-/// Used when setting castling rights during parsing of FEN strings.