StateとWMoveを保持する. [詳細]
#include <openingBook.h>
Public 型 | |
typedef std::vector< WMove > | WMoveContainer |
Public メソッド | |
WeightedBook (const char *filename) | |
~WeightedBook () | |
WMoveContainer | moves (int stateIndex, const bool zero_include=true) |
Return moves from the state of the stateIndex. | |
int | whiteWinCount (int stateIndex) |
int | blackWinCount (int stateIndex) |
CompactBoard | compactBoard (int stateIndex) |
SimpleState | board (int stateIndex) |
int | totalState () const |
int | startState () const |
void | validate () |
std::vector< int > | parents (const int stateIndex) |
As traversing the 'tree', return all state indices of the state's parents. | |
int | stateIndex (const SimpleState &state, const bool visit_zero=true, const Player player=BLACK) |
As traversing the 'tree', find a state index of the state. | |
int | stateIndex (const std::vector< Move > &moves) |
As traversing the 'tree', find a state index of the state reached by applying the moves from the initial state. | |
Private メソッド | |
void | seek (int offset) |
Private 変数 | |
int | n_states |
int | n_moves |
int | start_state |
std::ifstream | ifs |
Static Private 変数 | |
static const int | HEADER_SIZE = 16 |
static const int | STATE_SIZE = 16 |
static const int | MOVE_SIZE = 12 |
static const int | BOARD_SIZE = 41 * 4 |
StateとWMoveを保持する.
Stateはvector<WMove>を保持する WMoveはMoveとそのMoveを採用した時のStateのindexと手番から見た Moveの重み(0-1000)をもつ ファイル形式 version番号 - 4byte state数 - 4byte move数 - 4byte 開始state index - 4byte State - 16byte * state数 + WMoveの開始index + WMoveの数 + 先手の勝数 + 後手の勝数 WMove - 12byte * WMove数 + Move (4byte) + Stateのindex + Weight CompactBoard形式の盤面 - 164byte * state数
openingBook.h の 168 行で定義されています。
typedef std::vector<WMove> osl::book::WeightedBook::WMoveContainer |
openingBook.h の 175 行で定義されています。
osl::book::WeightedBook::WeightedBook | ( | const char * | filename | ) |
openingBook.cc の 116 行で定義されています。
参照先 ifs, n_moves, n_states, osl::book::readInt(), と start_state.
osl::book::WeightedBook::~WeightedBook | ( | ) |
openingBook.cc の 136 行で定義されています。
int osl::book::WeightedBook::blackWinCount | ( | int | stateIndex | ) |
openingBook.cc の 194 行で定義されています。
参照先 HEADER_SIZE, ifs, osl::book::readInt(), seek(), と STATE_SIZE.
osl::SimpleState osl::book::WeightedBook::board | ( | int | stateIndex | ) |
openingBook.cc の 177 行で定義されています。
参照先 compactBoard(), と osl::book::CompactBoard::state().
参照元 validate().
osl::book::CompactBoard osl::book::WeightedBook::compactBoard | ( | int | stateIndex | ) |
openingBook.cc の 167 行で定義されています。
参照先 BOARD_SIZE, HEADER_SIZE, ifs, MOVE_SIZE, n_moves, n_states, seek(), と STATE_SIZE.
参照元 board(), と stateIndex().
osl::book::WeightedBook::WMoveContainer osl::book::WeightedBook::moves | ( | int | stateIndex, | |
const bool | zero_include = true | |||
) |
Return moves from the state of the stateIndex.
If the zero_include is true, all of the moves are returned. Otherwise, the moves that have some weights (i.e. non-zero value) are returned.
openingBook.cc の 147 行で定義されています。
参照先 HEADER_SIZE, ifs, MOVE_SIZE, n_states, osl::book::readInt(), seek(), と STATE_SIZE.
参照元 parents(), osl::book::BookInMemory::readRecursive(), stateIndex(), と validate().
std::vector< int > osl::book::WeightedBook::parents | ( | const int | stateIndex | ) |
As traversing the 'tree', return all state indices of the state's parents.
openingBook.cc の 318 行で定義されています。
参照先 moves(), startState(), stateIndex(), と totalState().
void osl::book::WeightedBook::seek | ( | int | offset | ) | [private] |
openingBook.cc の 141 行で定義されています。
参照先 ifs.
参照元 blackWinCount(), compactBoard(), moves(), と whiteWinCount().
int osl::book::WeightedBook::startState | ( | ) | const [inline] |
openingBook.h の 190 行で定義されています。
参照先 start_state.
参照元 parents(), osl::book::BookInMemory::readAll(), と stateIndex().
int osl::book::WeightedBook::stateIndex | ( | const std::vector< Move > & | moves | ) |
As traversing the 'tree', find a state index of the state reached by applying the moves from the initial state.
Note that zero-weighted moves are visited.
moves | to apply |
int osl::book::WeightedBook::stateIndex | ( | const SimpleState & | state, | |
const bool | visit_zero = true , |
|||
const Player | player = BLACK | |||
) |
As traversing the 'tree', find a state index of the state.
If the visit_zero is true zero-weighted moves are visited (in this case, player is ignored). Otherwise, the palyer's zero-weighted moves are not visited.
state | to find | |
visit_zero | ||
player |
openingBook.cc の 242 行で定義されています。
参照先 compactBoard(), moves(), start_state, startState(), totalState(), と osl::book::CompactBoard::turn().
参照元 parents().
int osl::book::WeightedBook::totalState | ( | ) | const [inline] |
void osl::book::WeightedBook::validate | ( | ) |
openingBook.cc の 203 行で定義されています。
参照先 board(), osl::HIRATE, osl::NumEffectState::makeMove(), moves(), n_states, と start_state.
int osl::book::WeightedBook::whiteWinCount | ( | int | stateIndex | ) |
openingBook.cc の 184 行で定義されています。
参照先 HEADER_SIZE, ifs, osl::book::readInt(), seek(), と STATE_SIZE.
const int osl::book::WeightedBook::BOARD_SIZE = 41 * 4 [static, private] |
openingBook.h の 226 行で定義されています。
参照元 compactBoard().
const int osl::book::WeightedBook::HEADER_SIZE = 16 [static, private] |
openingBook.h の 223 行で定義されています。
参照元 blackWinCount(), compactBoard(), moves(), と whiteWinCount().
std::ifstream osl::book::WeightedBook::ifs [private] |
openingBook.h の 173 行で定義されています。
参照元 blackWinCount(), compactBoard(), moves(), seek(), WeightedBook(), と whiteWinCount().
const int osl::book::WeightedBook::MOVE_SIZE = 12 [static, private] |
openingBook.h の 225 行で定義されています。
参照元 compactBoard(), と moves().
int osl::book::WeightedBook::n_moves [private] |
openingBook.h の 171 行で定義されています。
参照元 compactBoard(), と WeightedBook().
int osl::book::WeightedBook::n_states [private] |
openingBook.h の 170 行で定義されています。
参照元 compactBoard(), moves(), totalState(), validate(), と WeightedBook().
int osl::book::WeightedBook::start_state [private] |
openingBook.h の 172 行で定義されています。
参照元 startState(), stateIndex(), validate(), と WeightedBook().
const int osl::book::WeightedBook::STATE_SIZE = 16 [static, private] |
openingBook.h の 224 行で定義されています。
参照元 blackWinCount(), compactBoard(), moves(), と whiteWinCount().