libkombilo
0.8
|
#include <pattern.h>
Public Member Functions | |
Pattern (int le, int ri, int to, int bo, int BOARDSIZE, int sX, int sY, const char *iPos, const std::vector< MoveNC > &CONTLIST, const char *CONTLABELS=0) throw (PatternError) | |
Pattern (int le, int ri, int to, int bo, int BOARDSIZE, int sX, int sY, const char *iPos) throw (PatternError) | |
Pattern (int type, int BOARDSIZE, int sX, int sY, const char *iPos, const std::vector< MoveNC > &CONTLIST, const char *CONTLABELS=0) | |
Pattern (int type, int BOARDSIZE, int sX, int sY, const char *iPos, const char *CONTLABELS=0) | |
Pattern (const Pattern &p) | |
Pattern (SnapshotVector &snv) | |
Pattern & | operator= (const Pattern &p) |
Pattern & | copy (const Pattern &p) |
char | getInitial (int i, int j) |
char | getFinal (int i, int j) |
char | BW2XO (char c) |
int | operator== (const Pattern &p) |
std::string | printPattern () |
void | to_snv (SnapshotVector &snv) |
Data Fields | |
int | left |
int | right |
int | bottom |
int | top |
int | boardsize |
int | sizeX |
int | sizeY |
int | flip |
int | colorSwitch |
char * | initialPos |
char * | finalPos |
char * | contLabels |
std::vector< MoveNC > | contList |
A pattern, say
XXOo ..Xx ..O*
is given by
sizeX
= 4 (the size along the horizontal axis), sizeY
= 3 (the size along the vertical axis), a
string initialPos = "XXOo..Xx..O*" of length sizeX*sizeY
which contains the "content" of the pattern.Here we use the following notation for search patterns:
. must be empty X
must have a black stone O
must have a white stone x
must be black or empty o
must be white or empty *
can be arbitraryWe use an analogous coordinate system as for the board, so a point with coordinates (i,j) is stored at position (i + j*sizeX) in the string.
The area of the board where we want to search for the given pattern (or, in other words, the set of permissible translations) is described by the parameters left
, right
, top
, bottom
where the rectangle with corners (left,top) and (right,bottom) is the set of possible positions for the upper left point of the pattern.
For instance, if all entries are 0, then the upper left corner is the only place where we would look for the pattern.
Instead of specifying left
, right
, top
, bottom
, in most cases one can just give the "pattern type", see the constants FULLBOARD_PATTERN, CENTER_PATTERN, etc.