All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
osl::RepetitionCounter Class Reference

千日手の検出. More...

#include <repetitionCounter.h>

Collaboration diagram for osl::RepetitionCounter:
Collaboration graph
[legend]

Classes

struct  Table
 

Public Types

typedef osl::slist< int > list_t
 

Public Member Functions

 RepetitionCounter ()
 
 RepetitionCounter (const RepetitionCounter &c)
 
 RepetitionCounter (const NumEffectState &initial)
 
 ~RepetitionCounter ()
 
void push (const NumEffectState &state, Move move)
 state の状態で move を(これから)指すことを記録 More...
 
void push (const NumEffectState &state)
 指した後の局面を記録 More...
 
void push (const HashKey &key, const NumEffectState &state)
 指した後の局面を記録 More...
 
void pop ()
 
void clear ()
 
const Sennichite isSennichite (const NumEffectState &state, Move move) const
 
const Sennichite isAlmostSennichite (const HashKey &key) const
 このまま同形を繰り返したらどの結果になるかを返す More...
 
const std::pair< Sennichite, int > distanceToSennichite (const HashKey &key) const
 
unsigned int countRepetition (const HashKey &) const
 
const list_t getRepetitions (const HashKey &) const
 
void printMatches (const HashKey &key) const
 
int getLastMove (const HashKey &key) const
 key の手を最後に登録した指手番号. More...
 
int getFirstMove (const HashKey &key) const
 key の手を最初に登録した指手番号. More...
 
int checkCount (Player attack) const
 
const HashKeyStack & history () const
 
bool isConsistent () const
 

Static Public Member Functions

static bool maybeEqual (const RepetitionCounter &l, const RepetitionCounter &r)
 

Private Member Functions

int order () const
 
void push (const HashKey &new_key, bool is_check)
 
const Sennichite isAlmostSennichiteUnsafe (int first_move) const
 

Private Attributes

boost::scoped_ptr< Tabletable
 
CArray< osl::vector< int >, 2 > continuous_check
 
HashKeyStack hash_history
 

Detailed Description

千日手の検出.

連続王手の千日手(同一局面の最初と4回目の間の一方の指し手が王手のみだった場合)は、連続王手をかけていたほうが負け。 http://www.computer-shogi.org/wcsc14/youryou.html

Definition at line 22 of file repetitionCounter.h.

Member Typedef Documentation

typedef osl::slist<int> osl::RepetitionCounter::list_t

Definition at line 30 of file repetitionCounter.h.

Constructor & Destructor Documentation

osl::RepetitionCounter::RepetitionCounter ( )

Definition at line 42 of file repetitionCounter.cc.

References clear().

osl::RepetitionCounter::RepetitionCounter ( const RepetitionCounter c)

Definition at line 48 of file repetitionCounter.cc.

References isConsistent(), and table.

osl::RepetitionCounter::RepetitionCounter ( const NumEffectState &  initial)
explicit

Definition at line 59 of file repetitionCounter.cc.

References clear(), and push().

osl::RepetitionCounter::~RepetitionCounter ( )

Definition at line 68 of file repetitionCounter.cc.

Member Function Documentation

int osl::RepetitionCounter::checkCount ( Player  attack) const
inline
void osl::RepetitionCounter::clear ( )

Definition at line 27 of file repetitionCounter.cc.

References continuous_check, hash_history, initial_capacity, and table.

Referenced by RepetitionCounter().

unsigned int osl::RepetitionCounter::countRepetition ( const HashKey &  key) const

Definition at line 199 of file repetitionCounter.cc.

Referenced by processRecord().

const std::pair< osl::Sennichite, int > osl::RepetitionCounter::distanceToSennichite ( const HashKey &  key) const
Returns
pair<isAlmostSennichite, count>

Definition at line 190 of file repetitionCounter.cc.

References osl::Sennichite::NORMAL().

Referenced by osl::game_playing::HistoryToTable::adjustTable().

int osl::RepetitionCounter::getFirstMove ( const HashKey &  key) const

key の手を最初に登録した指手番号.

Returns
初めての局面では-1

Definition at line 161 of file repetitionCounter.cc.

References result.

Referenced by isAlmostSennichite(), and processRecord().

int osl::RepetitionCounter::getLastMove ( const HashKey &  key) const

key の手を最後に登録した指手番号.

Returns
初めての局面では-1

Definition at line 153 of file repetitionCounter.cc.

const list_t osl::RepetitionCounter::getRepetitions ( const HashKey &  key) const

Definition at line 208 of file repetitionCounter.cc.

const HashKeyStack& osl::RepetitionCounter::history ( ) const
inline
const Sennichite osl::RepetitionCounter::isAlmostSennichite ( const HashKey &  key) const
inline

このまま同形を繰り返したらどの結果になるかを返す

Definition at line 71 of file repetitionCounter.h.

References getFirstMove(), isAlmostSennichiteUnsafe(), and osl::Sennichite::NORMAL().

Referenced by osl::game_playing::GameState::generateMoves(), and processRecord().

const Sennichite osl::RepetitionCounter::isAlmostSennichiteUnsafe ( int  first_move) const
inlineprivate
bool osl::RepetitionCounter::isConsistent ( ) const

Definition at line 231 of file repetitionCounter.cc.

References osl::alt(), and order.

Referenced by RepetitionCounter().

const osl::Sennichite osl::RepetitionCounter::isSennichite ( const NumEffectState &  state,
Move  move 
) const

Definition at line 175 of file repetitionCounter.cc.

References osl::Sennichite::NORMAL().

Referenced by processRecord().

bool osl::RepetitionCounter::maybeEqual ( const RepetitionCounter l,
const RepetitionCounter r 
)
static

Definition at line 265 of file repetitionCounter.cc.

References continuous_check, hash_history, and table.

int osl::RepetitionCounter::order ( ) const
inlineprivate

Definition at line 28 of file repetitionCounter.h.

References hash_history.

Referenced by isAlmostSennichiteUnsafe().

void osl::RepetitionCounter::pop ( )

Definition at line 128 of file repetitionCounter.cc.

References osl::alt(), and order.

Referenced by osl::search::SearchState2Core::popAfterApply().

void osl::RepetitionCounter::printMatches ( const HashKey &  key) const

Definition at line 218 of file repetitionCounter.cc.

void osl::RepetitionCounter::push ( const HashKey &  new_key,
bool  is_check 
)
private
void osl::RepetitionCounter::push ( const NumEffectState &  state,
Move  move 
)

state の状態で move を(これから)指すことを記録

Definition at line 112 of file repetitionCounter.cc.

References osl::Move::isPass(), osl::Move::isValidOrPass(), and osl::Move::player().

void osl::RepetitionCounter::push ( const NumEffectState &  state)

指した後の局面を記録

Definition at line 106 of file repetitionCounter.cc.

void osl::RepetitionCounter::push ( const HashKey &  key,
const NumEffectState &  state 
)

指した後の局面を記録

Definition at line 99 of file repetitionCounter.cc.

Member Data Documentation

CArray<osl::vector<int>, 2> osl::RepetitionCounter::continuous_check
private

Definition at line 26 of file repetitionCounter.h.

Referenced by checkCount(), clear(), isAlmostSennichiteUnsafe(), and maybeEqual().

HashKeyStack osl::RepetitionCounter::hash_history
private

Definition at line 27 of file repetitionCounter.h.

Referenced by clear(), history(), maybeEqual(), and order().

boost::scoped_ptr<Table> osl::RepetitionCounter::table
private

Definition at line 24 of file repetitionCounter.h.

Referenced by clear(), maybeEqual(), and RepetitionCounter().


The documentation for this class was generated from the following files: