osl::record::CheckDuplicate Class Reference

Container of moves to check duplicated games. More...

`#include <checkDuplicate.h>`

## Public Types

enum | DUPLICATE_RESULT { NO_DUPLICATE = 0 , HASH_DUPLICATE = 1 , MOVES_DUPLICATE = 2 }
| Result type of checking duplicates. More...

## Public Member Functions

| CheckDuplicate ()
| Constructor.
DUPLICATE_RESULT | regist (const std::vector< Move > &moves)
| Insert a key if the key is new.
void | print (std::ostream &out) const
| Output the result.
size_t | getRegists () const
| Return a couter of registings (trials).
size_t | getDuplicatedHash () const
| Return a counter of duplicated ending states.
size_t | getDuplicatedMoves () const
| Return a counter of duplicated moves.

## Static Public Member Functions

static std::pair< HashKey, PathEncoding > | getLastState (const std::vector< Move > &moves)

## Private Types

typedef std::unordered_map< HashKey, std::vector< PathEncoding >, std::hash< HashKey > > | keymap_t

## Private Member Functions

DUPLICATE_RESULT | regist (const HashKey &key, const PathEncoding &moves)
| Insert a key if the key is new.

## Private Attributes

keymap_t | keys
| container of moves
size_t | regist_counter
| couter for registing (trials)
size_t | duplicated_hash_counter
| counter for hash matches with different moves
size_t | duplicated_moves_counter
| counter for exact matches of moves

## Detailed Description

Container of moves to check duplicated games.

Definition at line 19 of file checkDuplicate.h.

## Member Typedef Documentation

## keymap_t

typedef std::unordered_map<HashKey, std::vector<PathEncoding>, std::hash<HashKey> > osl::record::CheckDuplicate::keymap_t

private

Definition at line 21 of file checkDuplicate.h.

## Member Enumeration Documentation

## DUPLICATE_RESULT

enum osl::record::CheckDuplicate::DUPLICATE_RESULT

Result type of checking duplicates.

Enumerator
NO_DUPLICATE |
HASH_DUPLICATE |
MOVES_DUPLICATE |

Definition at line 37 of file checkDuplicate.h.

## Constructor & Destructor Documentation

## CheckDuplicate()

osl::record::CheckDuplicate::CheckDuplicate | ( |  | ) |

inline

Constructor.

Definition at line 47 of file checkDuplicate.h.

References duplicated_hash_counter, duplicated_moves_counter, and regist_counter.

## Member Function Documentation

## getDuplicatedHash()

size_t osl::record::CheckDuplicate::getDuplicatedHash | ( |  | ) | const

inline

Return a counter of duplicated ending states.

The moves may or may not match.

Definition at line 79 of file checkDuplicate.h.

References duplicated_hash_counter.

## getDuplicatedMoves()

size_t osl::record::CheckDuplicate::getDuplicatedMoves | ( |  | ) | const

inline

Return a counter of duplicated moves.

The moves are exactly same.

Definition at line 85 of file checkDuplicate.h.

References duplicated_moves_counter.

## getLastState()

std::pair< osl::HashKey, osl::PathEncoding > osl::record::CheckDuplicate::getLastState | ( | const std::vector< Move > & | moves | ) |

static

Definition at line 6 of file checkDuplicate.cc.

References osl::BLACK, osl::NumEffectState::isConsistent(), osl::NumEffectState::makeMove(), and osl::PathEncoding::pushMove().

Referenced by regist().

## getRegists()

size_t osl::record::CheckDuplicate::getRegists | ( |  | ) | const

inline

Return a couter of registings (trials).

Definition at line 72 of file checkDuplicate.h.

References regist_counter.

## print()

void osl::record::CheckDuplicate::print | ( | std::ostream & | out | ) | const

Output the result.

Definition at line 59 of file checkDuplicate.cc.

References duplicated_hash_counter, duplicated_moves_counter, keys, and regist_counter.

## regist() [1/2]

osl::record::CheckDuplicate::DUPLICATE_RESULT osl::record::CheckDuplicate::regist | ( | const HashKey & | key,
|  | const PathEncoding & | moves )

private

Insert a key if the key is new.

Parameters

  key | a hash key of the last state of the moves
  moves |

Returns
  false if (i) the key is new or (ii) duplicated with different moves; true if the moves are exactly found in this container.

Definition at line 27 of file checkDuplicate.cc.

References duplicated_hash_counter, duplicated_moves_counter, HASH_DUPLICATE, keys, MOVES_DUPLICATE, NO_DUPLICATE, and regist_counter.

## regist() [2/2]

osl::record::CheckDuplicate::DUPLICATE_RESULT osl::record::CheckDuplicate::regist | ( | const std::vector< Move > & | moves | ) |

Insert a key if the key is new.

The key is the last state of the moves.

Parameters

  moves |

Returns
  false if (i) the key is new or (ii) duplicated with different moves; true if the moves are exactly found in this container.

Definition at line 20 of file checkDuplicate.cc.

References getLastState(), and regist().

Referenced by regist().

## Member Data Documentation

## duplicated_hash_counter

size_t osl::record::CheckDuplicate::duplicated_hash_counter

private

counter for hash matches with different moves

Definition at line 27 of file checkDuplicate.h.

Referenced by CheckDuplicate(), getDuplicatedHash(), print(), and regist().

## duplicated_moves_counter

size_t osl::record::CheckDuplicate::duplicated_moves_counter

private

counter for exact matches of moves

Definition at line 29 of file checkDuplicate.h.

Referenced by CheckDuplicate(), getDuplicatedMoves(), print(), and regist().

## keys

keymap_t osl::record::CheckDuplicate::keys

private

container of moves

Definition at line 23 of file checkDuplicate.h.

Referenced by print(), and regist().

## regist_counter

size_t osl::record::CheckDuplicate::regist_counter

private

couter for registing (trials)

Definition at line 25 of file checkDuplicate.h.

Referenced by CheckDuplicate(), getRegists(), print(), and regist().

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

- checkDuplicate.h
- checkDuplicate.cc