Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HandCodedPattern Class Reference

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>

List of all members.

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]

Detailed Description

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.

Todo:
Want hand-coded vulnerable patterns, not just dominated

Definition at line 23 of file HandCodedPattern.hpp.


Constructor & Destructor Documentation

HandCodedPattern::HandCodedPattern (  ) 

Constructor, sets dominator and dominatee to INVALID_POINT.

Definition at line 13 of file HandCodedPattern.cpp.

HandCodedPattern::HandCodedPattern ( HexPoint  dominatee,
HexPoint  dominator 
) [explicit]

Constructor.

Definition at line 19 of file HandCodedPattern.cpp.

HandCodedPattern::~HandCodedPattern (  ) 

Destructor.

Definition at line 25 of file HandCodedPattern.cpp.


Member Function Documentation

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]
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().

void HandCodedPattern::set ( HexColor  color,
const bitset_t bs 
)

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]

Sets the dominator.

Definition at line 90 of file HandCodedPattern.hpp.

References m_dominator.

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().


Member Data Documentation

Definition at line 77 of file HandCodedPattern.hpp.

Referenced by check(), flipColors(), mirror(), rotate(), and set().

Definition at line 75 of file HandCodedPattern.hpp.

Referenced by dominatee(), mirror(), rotate(), and setDominatee().

Definition at line 75 of file HandCodedPattern.hpp.

Referenced by dominator(), mirror(), rotate(), and setDominator().

Definition at line 76 of file HandCodedPattern.hpp.

Referenced by check(), mirror(), rotate(), and setMask().


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


6 Jan 2011 Doxygen 1.6.3