Changeset 153 for 06/devel/pattern.h

Show
Ignore:
Timestamp:
04/15/04 16:23:16 (5 years ago)
Author:
ug
Message:

Continued transcoding patternPY

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 06/devel/pattern.h

    r136 r153  
    1 typedef charp char*; 
     1// File: pattern.h 
     2 
     3//   Copyright (C) 2004 Ulrich Goertz (u@g0ertz.de) 
     4 
     5//   This is part of Kombilo, a go database program. 
     6 
     7//   This program is free software; you can redistribute it and/or modify 
     8//   it under the terms of the GNU General Public License as published by 
     9//   the Free Software Foundation; either version 2 of the License, or 
     10//   (at your option) any later version. 
     11 
     12//   This program is distributed in the hope that it will be useful, 
     13//   but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15//   GNU General Public License for more details. 
     16 
     17//   You should have received a copy of the GNU General Public License 
     18//   along with this program (see doc/license.txt); if not, write to the Free Software 
     19//   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     20//   The GNU GPL is also currently available at 
     21//   http://www.gnu.org/copyleft/gpl.html 
     22 
     23 
     24using namespace std; 
     25 
     26#include "Python.h" 
     27#include <vector> 
     28 
     29typedef char* charp; 
    230 
    331class Symmetries { 
     32 public: 
    433  int* dataX; 
    534  int* dataY; 
     
    736  int sizeX; 
    837  int sizeY; 
    9  public: 
    10   Symmetries(int sX, int sY); 
     38  Symmetries(int sX=0, int sY=0); 
    1139  ~Symmetries(); 
    1240  Symmetries(const Symmetries& s); 
     
    1745  int getCS(int i, int j); 
    1846  int has_key(int i, int j); 
     47  int special; 
    1948}; 
    2049 
     
    3665  int lenContList; 
    3766 
    38   Pattern(PyObject* anch, PyObject* initialDict, PyObject* contList, char mOne); 
     67  Pattern(); 
     68  Pattern(int le, int ri, int to, int bo, int sX, int sY, 
     69          char* iPos, char* cList, int lenCList, char mOne); 
    3970  Pattern(const Pattern& p); 
    4071  ~Pattern(); 
    41   Pattern& operator=(const Pattern& p); 
     72  Pattern& copy(const Pattern& p); 
     73 
     74  char getInitial(int i, int j); 
     75  char getFinal(int i, int j); 
     76  char getBits(int b, int i); 
    4277 
    4378  char BW2XO(char c); 
    44   bool operator==(const &Pattern p); 
    45 } 
     79  int operator==(const Pattern& p); 
     80 
     81  static int flipsX(int i, int x, int y, int XX, int YY); 
     82  static int flipsY(int i, int x, int y, int XX, int YY); 
     83  static int PatternInvFlip(int i); 
     84 
     85}; 
    4686 
    4787 
    4888class PatternList { 
    4989 public: 
     90  int boardsize; 
    5091  Pattern pattern; 
    5192  int fixedColor, nextMove; 
     
    5394  Symmetries symmetries; 
    5495 
    55   PatternList(Pattern p, int fColor, int nMove); 
     96  PatternList(Pattern& p, int fColor, int nMove, int bsize); 
    5697  PatternList(const PatternList& pl); 
    5798  PatternList& operator=(const PatternList& pl); 
     
    59100  char invertColor(char co); 
    60101  vector<Pattern> patternList(); 
    61   Pattern get(int i); 
     102  Pattern& get(int i); 
    62103  int size(); 
    63   updateContinuations(); 
     104  PyObject* updateContinuations(int index, int x, int y, char co, int Xint0, int Xint1,  
     105                                int Yint0, int Yint1, 
     106                                int foundWhere, int counter, 
     107                                PyObject* continuations, char* contLabels, int contLabelsIndex, 
     108                                char winner); 
    64109}; 
    65110