Special patterns that are too big to check with a PatternBoard (to do so would mean increasing Pattern::MAX_EXTENSION, thus slowing down PatternBoard::update()). More...
#include <HandCodedPattern.hpp>
Public Member Functions | |
HandCodedPattern () | |
Constructor, sets dominator and dominatee to INVALID_POINT. | |
HandCodedPattern (HexPoint dominatee, HexPoint dominator) | |
Constructor. | |
~HandCodedPattern () | |
Destructor. | |
void | setDominatee (HexPoint dominatee) |
Sets the dominated cell. | |
HexPoint | dominatee () const |
Returns the dominated cell. | |
void | setDominator (HexPoint dominator) |
Sets the dominator. | |
HexPoint | dominator () const |
Returns the dominator. | |
void | setMask (const bitset_t &bs) |
Sets the mask for the pattern. | |
void | set (HexColor color, const bitset_t &bs) |
Sets the bitset for the given color. | |
void | rotate (const ConstBoard &brd) |
Rotates the pattern on the given board. | |
void | mirror (const ConstBoard &brd) |
Mirrors the pattern on the given board. | |
void | flipColors () |
Flips black to white and vice versa. | |
bool | check (const StoneBoard &brd) |
True if pattern matches board. | |
Static Public Member Functions | |
static void | CreatePatterns (std::vector< HandCodedPattern > &out) |
Adds all HandCodedPatterns into out. | |
Private Attributes | |
HexPoint | m_dominatee |
HexPoint | m_dominator |
bitset_t | m_mask |
bitset_t | m_color [BLACK_AND_WHITE] |
Special patterns that are too big to check with a PatternBoard (to do so would mean increasing Pattern::MAX_EXTENSION, thus slowing down PatternBoard::update()).
These are static patterns -- so they are not translated.
Definition at line 23 of file HandCodedPattern.hpp.
HandCodedPattern::HandCodedPattern | ( | ) |
Constructor, sets dominator and dominatee to INVALID_POINT.
Definition at line 13 of file HandCodedPattern.cpp.
Constructor.
Definition at line 19 of file HandCodedPattern.cpp.
HandCodedPattern::~HandCodedPattern | ( | ) |
Destructor.
Definition at line 25 of file HandCodedPattern.cpp.
bool HandCodedPattern::check | ( | const StoneBoard & | brd | ) |
True if pattern matches board.
Definition at line 60 of file HandCodedPattern.cpp.
References StoneBoard::GetColor(), m_color, and m_mask.
Referenced by ICEngine::CheckHandCodedDominates().
void HandCodedPattern::CreatePatterns | ( | std::vector< HandCodedPattern > & | out | ) | [static] |
Adds all HandCodedPatterns into out.
Definition at line 70 of file HandCodedPattern.cpp.
References HEX_CELL_A1, HEX_CELL_A2, HEX_CELL_A3, HEX_CELL_A4, HEX_CELL_B1, HEX_CELL_B2, HEX_CELL_B3, HEX_CELL_C1, HEX_CELL_C2, HEX_CELL_D1, benzene_bitset< _Nb >::reset(), set(), benzene_bitset< _Nb >::set(), setDominatee(), setMask(), and WHITE.
Referenced by ICEngine::LoadHandCodedPatterns().
HexPoint HandCodedPattern::dominatee | ( | ) | const [inline] |
Returns the dominated cell.
Definition at line 85 of file HandCodedPattern.hpp.
References m_dominatee.
Referenced by ICEngine::CheckHandCodedDominates().
HexPoint HandCodedPattern::dominator | ( | ) | const [inline] |
Returns the dominator.
Definition at line 95 of file HandCodedPattern.hpp.
References m_dominator.
Referenced by ICEngine::CheckHandCodedDominates().
void HandCodedPattern::flipColors | ( | ) |
Flips black to white and vice versa.
Definition at line 55 of file HandCodedPattern.cpp.
References BLACK, m_color, and WHITE.
Referenced by ICEngine::CheckHandCodedDominates().
void HandCodedPattern::mirror | ( | const ConstBoard & | brd | ) |
Mirrors the pattern on the given board.
Definition at line 46 of file HandCodedPattern.cpp.
References m_color, m_dominatee, m_dominator, m_mask, and BoardUtils::Mirror().
Referenced by ICEngine::CheckHandCodedDominates().
void HandCodedPattern::rotate | ( | const ConstBoard & | brd | ) |
Rotates the pattern on the given board.
Definition at line 37 of file HandCodedPattern.cpp.
References m_color, m_dominatee, m_dominator, m_mask, and BoardUtils::Rotate().
Referenced by ICEngine::CheckHandCodedDominates().
Sets the bitset for the given color.
Definition at line 31 of file HandCodedPattern.cpp.
References HexAssert, HexColorUtil::isBlackWhite(), and m_color.
Referenced by CreatePatterns().
void HandCodedPattern::setDominatee | ( | HexPoint | dominatee | ) | [inline] |
Sets the dominated cell.
Definition at line 80 of file HandCodedPattern.hpp.
References m_dominatee.
Referenced by CreatePatterns().
void HandCodedPattern::setDominator | ( | HexPoint | dominator | ) | [inline] |
void HandCodedPattern::setMask | ( | const bitset_t & | bs | ) | [inline] |
Sets the mask for the pattern.
Definition at line 100 of file HandCodedPattern.hpp.
References m_mask.
Referenced by CreatePatterns().
bitset_t HandCodedPattern::m_color[BLACK_AND_WHITE] [private] |
Definition at line 77 of file HandCodedPattern.hpp.
Referenced by check(), flipColors(), mirror(), rotate(), and set().
HexPoint HandCodedPattern::m_dominatee [private] |
Definition at line 75 of file HandCodedPattern.hpp.
Referenced by dominatee(), mirror(), rotate(), and setDominatee().
HexPoint HandCodedPattern::m_dominator [private] |
Definition at line 75 of file HandCodedPattern.hpp.
Referenced by dominator(), mirror(), rotate(), and setDominator().
bitset_t HandCodedPattern::m_mask [private] |