Public 型 | Public メソッド | Private メソッド | Private 変数 | Static Private 変数

クラス osl::book::WeightedBook

StateとWMoveを保持する. [詳細]

#include <openingBook.h>

すべてのメンバ一覧

Public 型

typedef std::vector< WMoveWMoveContainer

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.h168 行で定義されています。


型定義

openingBook.h175 行で定義されています。


コンストラクタとデストラクタ

osl::book::WeightedBook::WeightedBook ( const char *  filename  ) 

openingBook.cc116 行で定義されています。

参照先 ifs, n_moves, n_states, osl::book::readInt(), と start_state.

osl::book::WeightedBook::~WeightedBook (  ) 

openingBook.cc136 行で定義されています。


関数

int osl::book::WeightedBook::blackWinCount ( int  stateIndex  ) 

openingBook.cc194 行で定義されています。

参照先 HEADER_SIZE, ifs, osl::book::readInt(), seek(), と STATE_SIZE.

参照元 osl::book::BookInMemory::readRecursive().

osl::SimpleState osl::book::WeightedBook::board ( int  stateIndex  ) 

openingBook.cc177 行で定義されています。

参照先 compactBoard(), と osl::book::CompactBoard::state().

参照元 validate().

osl::book::CompactBoard osl::book::WeightedBook::compactBoard ( int  stateIndex  ) 

openingBook.cc167 行で定義されています。

参照先 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.cc147 行で定義されています。

参照先 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.

戻り値:
state indexes; empty if there is none.

openingBook.cc318 行で定義されています。

参照先 moves(), startState(), stateIndex(), と totalState().

void osl::book::WeightedBook::seek ( int  offset  )  [private]

openingBook.cc141 行で定義されています。

参照先 ifs.

参照元 blackWinCount(), compactBoard(), moves(), と whiteWinCount().

int osl::book::WeightedBook::startState (  )  const [inline]

openingBook.h190 行で定義されています。

参照先 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
戻り値:
state index; if it is not found, return -1.
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 
戻り値:
a state index of the state; if it is not found, return -1.

openingBook.cc242 行で定義されています。

参照先 compactBoard(), moves(), start_state, startState(), totalState(), と osl::book::CompactBoard::turn().

参照元 parents().

int osl::book::WeightedBook::totalState (  )  const [inline]

openingBook.h189 行で定義されています。

参照先 n_states.

参照元 parents(), と stateIndex().

void osl::book::WeightedBook::validate (  ) 

openingBook.cc203 行で定義されています。

参照先 board(), osl::HIRATE, osl::NumEffectState::makeMove(), moves(), n_states, と start_state.

int osl::book::WeightedBook::whiteWinCount ( int  stateIndex  ) 

openingBook.cc184 行で定義されています。

参照先 HEADER_SIZE, ifs, osl::book::readInt(), seek(), と STATE_SIZE.

参照元 osl::book::BookInMemory::readRecursive().


変数

const int osl::book::WeightedBook::BOARD_SIZE = 41 * 4 [static, private]

openingBook.h226 行で定義されています。

参照元 compactBoard().

const int osl::book::WeightedBook::HEADER_SIZE = 16 [static, private]

openingBook.h223 行で定義されています。

参照元 blackWinCount(), compactBoard(), moves(), と whiteWinCount().

std::ifstream osl::book::WeightedBook::ifs [private]

openingBook.h173 行で定義されています。

参照元 blackWinCount(), compactBoard(), moves(), seek(), WeightedBook(), と whiteWinCount().

const int osl::book::WeightedBook::MOVE_SIZE = 12 [static, private]

openingBook.h225 行で定義されています。

参照元 compactBoard(), と moves().

openingBook.h171 行で定義されています。

参照元 compactBoard(), と WeightedBook().

openingBook.h170 行で定義されています。

参照元 compactBoard(), moves(), totalState(), validate(), と WeightedBook().

openingBook.h172 行で定義されています。

参照元 startState(), stateIndex(), validate(), と WeightedBook().

const int osl::book::WeightedBook::STATE_SIZE = 16 [static, private]

openingBook.h224 行で定義されています。

参照元 blackWinCount(), compactBoard(), moves(), と whiteWinCount().


このクラスの説明は次のファイルから生成されました:
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義