Standard RingGodel with an added mask to use when checking if two RingGodels match. More...
#include <RingGodel.hpp>
Public Member Functions | |
PatternRingGodel () | |
Constructs pattern ring godel with empty mask. | |
virtual | ~PatternRingGodel () |
Destructor. | |
virtual void | SetEmpty () |
Sets the godel and mask to empty. | |
void | AddSliceToMask (int slice) |
Adds the given slice to the mask. | |
bool | MatchesGodel (const RingGodel &godel) const |
Returns true if we match godel on our mask. | |
void | AddColorToSlice (int slice, HexColor color) |
Adds BLACK, WHITE or EMPTY to slice in ring_godel. | |
void | RemoveColorFromSlice (int slice, HexColor color) |
Removes a color from a slice: color can be BLACK, WHITE, EMPTY. | |
void | SetSliceToColor (int slice, HexColor color) |
Sets the color of slice: color can be BLACK, WHITE, EMPTY. | |
int | Index () const |
Returns the index of this ring_godel; use to hash into arrays. | |
int | Value () const |
Returns godel as an integer. | |
Static Public Member Functions | |
static const std::vector < RingGodel > & | ValidGodels () |
Returns the valid ring godels. | |
Static Protected Member Functions | |
static int | Score (HexColor color) |
Score for color in a slice. | |
static int | AdjustScoreBySlice (int score, int slice) |
Adjusts a score by the slice. | |
Protected Attributes | |
int | m_value |
The actual godel value. | |
Static Protected Attributes | |
static const int | BITS_PER_SLICE = 3 |
Number of bits to use for each slice in the ring godel. | |
static const int | SLICE_MASK = 7 |
Sould be 1<<(BITS_PER_SLICE) - 1. | |
Private Attributes | |
int | m_mask |
Standard RingGodel with an added mask to use when checking if two RingGodels match.
Definition at line 128 of file RingGodel.hpp.
PatternRingGodel::PatternRingGodel | ( | ) |
Constructs pattern ring godel with empty mask.
Definition at line 85 of file RingGodel.cpp.
PatternRingGodel::~PatternRingGodel | ( | ) | [virtual] |
Destructor.
Definition at line 91 of file RingGodel.cpp.
void RingGodel::AddColorToSlice | ( | int | slice, | |
HexColor | color | |||
) | [inherited] |
Adds BLACK, WHITE or EMPTY to slice in ring_godel.
Definition at line 54 of file RingGodel.cpp.
References RingGodel::GlobalData::color_slice_score, RingGodel::GetGlobalData(), and RingGodel::m_value.
Referenced by PatternState::Update(), and PatternState::UpdateRingGodel().
void PatternRingGodel::AddSliceToMask | ( | int | slice | ) |
Adds the given slice to the mask.
Definition at line 101 of file RingGodel.cpp.
References RingGodel::AdjustScoreBySlice(), m_mask, and RingGodel::SLICE_MASK.
Referenced by Pattern::compute_ring_godel().
int RingGodel::AdjustScoreBySlice | ( | int | score, | |
int | slice | |||
) | [inline, static, protected, inherited] |
Adjusts a score by the slice.
Definition at line 107 of file RingGodel.hpp.
References RingGodel::BITS_PER_SLICE.
Referenced by AddSliceToMask(), and RingGodel::GlobalData::GlobalData().
int RingGodel::Index | ( | ) | const [inherited] |
Returns the index of this ring_godel; use to hash into arrays.
Definition at line 78 of file RingGodel.cpp.
References RingGodel::GetValidGodelData(), RingGodel::ValidGodelData::godel_to_index, and RingGodel::m_value.
Referenced by HashedPatternSet::ListForGodel().
bool PatternRingGodel::MatchesGodel | ( | const RingGodel & | godel | ) | const |
Returns true if we match godel on our mask.
For a match to occur, each corresponding slice in godel must be a superset of the slice in this godel. If godel has BW, then B or W or BW will match it, but if we have BW, only BW in godel will match.
Definition at line 106 of file RingGodel.cpp.
References m_mask, RingGodel::m_value, and RingGodel::Value().
Referenced by PatternState::CheckRingGodel(), and HashedPatternSet::hash().
void RingGodel::RemoveColorFromSlice | ( | int | slice, | |
HexColor | color | |||
) | [inherited] |
Removes a color from a slice: color can be BLACK, WHITE, EMPTY.
Definition at line 59 of file RingGodel.cpp.
References RingGodel::GlobalData::color_slice_score, RingGodel::GetGlobalData(), and RingGodel::m_value.
Referenced by PatternState::Update(), and PatternState::UpdateRingGodel().
int RingGodel::Score | ( | HexColor | color | ) | [inline, static, protected, inherited] |
Score for color in a slice.
Definition at line 112 of file RingGodel.hpp.
References BLACK, EMPTY, HexAssert, and WHITE.
Referenced by RingGodel::GlobalData::GlobalData().
void PatternRingGodel::SetEmpty | ( | ) | [virtual] |
Sets the godel and mask to empty.
Reimplemented from RingGodel.
Definition at line 95 of file RingGodel.cpp.
References m_mask.
Referenced by Pattern::compute_ring_godel().
void RingGodel::SetSliceToColor | ( | int | slice, | |
HexColor | color | |||
) | [inherited] |
Sets the color of slice: color can be BLACK, WHITE, EMPTY.
Definition at line 64 of file RingGodel.cpp.
References RingGodel::GlobalData::color_slice_score, RingGodel::GetGlobalData(), RingGodel::m_value, and RingGodel::GlobalData::mask_slice_score.
Referenced by Pattern::compute_ring_godel().
const std::vector< RingGodel > & RingGodel::ValidGodels | ( | ) | [static, inherited] |
Returns the valid ring godels.
Definition at line 122 of file RingGodel.cpp.
References RingGodel::GetValidGodelData(), and RingGodel::ValidGodelData::valid_godel.
Referenced by HashedPatternSet::hash().
int RingGodel::Value | ( | ) | const [inline, inherited] |
Returns godel as an integer.
Definition at line 102 of file RingGodel.hpp.
References RingGodel::m_value.
Referenced by MatchesGodel().
const int RingGodel::BITS_PER_SLICE = 3 [static, protected, inherited] |
Number of bits to use for each slice in the ring godel.
Definition at line 61 of file RingGodel.hpp.
Referenced by RingGodel::AdjustScoreBySlice(), and RingGodel::ValidGodelData::ValidGodelData().
int PatternRingGodel::m_mask [private] |
Definition at line 152 of file RingGodel.hpp.
Referenced by AddSliceToMask(), MatchesGodel(), and SetEmpty().
int RingGodel::m_value [protected, inherited] |
The actual godel value.
Definition at line 58 of file RingGodel.hpp.
Referenced by RingGodel::AddColorToSlice(), RingGodel::Index(), MatchesGodel(), RingGodel::RemoveColorFromSlice(), RingGodel::SetEmpty(), RingGodel::SetSliceToColor(), and RingGodel::Value().
const int RingGodel::SLICE_MASK = 7 [static, protected, inherited] |
Sould be 1<<(BITS_PER_SLICE) - 1.
Definition at line 64 of file RingGodel.hpp.
Referenced by AddSliceToMask(), and RingGodel::GlobalData::GlobalData().