root/06/devel-old/algos.h
| Revision 175, 3.6 kB (checked in by ug, 2 years ago) |
|---|
| Line | |
|---|---|
| 1 | // File: algos.h |
| 2 | |
| 3 | // Copyright (C) 2001-6 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 | #include "Python.h" |
| 24 | |
| 25 | class Algorithm { |
| 26 | public: |
| 27 | Algorithm(int bsize); |
| 28 | |
| 29 | void initialize_process(); |
| 30 | void newgame_process(); |
| 31 | void AB_process(int x, int y); |
| 32 | void AW_process(int x, int y); |
| 33 | void AE_process(int x, int y, char removed); |
| 34 | void endOfNode_process(); |
| 35 | void B_process(int counter, int x, int y, PyObject* cap); |
| 36 | void W_process(int counter, int x, int y, PyObject* cap); |
| 37 | void branchpoint_process(); |
| 38 | void endOfVariation_process(); |
| 39 | void endgame_process(); |
| 40 | void finalize_process(datap); |
| 41 | |
| 42 | int boardsize; |
| 43 | static char** filelist; |
| 44 | PyObject* search(PatternList patternList, PyObject* options, PyObject* gamelist, PyObject* matchlist); |
| 45 | }; |
| 46 | |
| 47 | |
| 48 | |
| 49 | class Algo_finalpos : public Algorithm { |
| 50 | public: |
| 51 | Algo_finalpos(int bsize); |
| 52 | ~Algo_finalpos(); |
| 53 | |
| 54 | char* finalpos; |
| 55 | char* fp; |
| 56 | int fpIndex; |
| 57 | int finalposIndex; |
| 58 | int finalposSize; |
| 59 | }; |
| 60 | |
| 61 | // in x-coord: |
| 62 | const int ENDOFNODE = 128; |
| 63 | const int BRANCHPOINT = 64; |
| 64 | const int ENDOFVARIATION = 32; |
| 65 | |
| 66 | // in y-coord |
| 67 | const int REMOVE = 128; |
| 68 | const int BLACK = 64; |
| 69 | const int WHITE = 32; |
| 70 | |
| 71 | |
| 72 | class Algo_movelist : public Algorithm { |
| 73 | public: |
| 74 | Algo_movelist(int bsize); |
| 75 | ~Algo_movelist(); |
| 76 | |
| 77 | vector<char> mainlistArr; |
| 78 | vector<long> posTable; |
| 79 | |
| 80 | int finalposCSize; |
| 81 | int finalposCIndex; |
| 82 | char* finalposC; |
| 83 | |
| 84 | vector<char> movelist; |
| 85 | |
| 86 | int fpCSize; |
| 87 | int fpCIndex; |
| 88 | char* fpC; |
| 89 | |
| 90 | }; |
| 91 | |
| 92 | |
| 93 | // const int NOT_HASHABLE = MAXINT-1; |
| 94 | // |
| 95 | // class Algo_hash : public Algorithm { |
| 96 | // public: |
| 97 | // Algo_hash(int bsize, plist, char* fname); |
| 98 | // ~Algo_hash(); |
| 99 | // |
| 100 | // long compute_hashkey(Pattern pattern, type); |
| 101 | // |
| 102 | // hash_global; |
| 103 | // int gameCtr; |
| 104 | // branchpoints; |
| 105 | // poslist; |
| 106 | // char* filename; |
| 107 | // }; |
| 108 | // |
| 109 | // |
| 110 | // |
| 111 | // class UIntervals { |
| 112 | // public: |
| 113 | // UIntervals(); |
| 114 | // |
| 115 | // int first(); |
| 116 | // void append(UIntervals interv); |
| 117 | // void inters(UIntervals uinterv); |
| 118 | // int isEmpty(); |
| 119 | // |
| 120 | // vector<pair<int,int>> data; |
| 121 | // |
| 122 | // }; |
| 123 | // |
| 124 | // |
| 125 | // class Algo_intervals : public Algorithm { |
| 126 | // public: |
| 127 | // Algo_intervals(int bsize); |
| 128 | // ~Algo_intervals(); |
| 129 | // |
| 130 | // vector<long> movesArr; |
| 131 | // vector<long> moveIntsArr; |
| 132 | // |
| 133 | // vector<vector<int>*> moves; |
| 134 | // |
| 135 | // int counter; |
| 136 | // int ignore; |
| 137 | // }; |
| 138 | // |
| 139 | // const int MAXNOMOVES = 16777215; |
| 140 | // const int FLAG_POINTER = 16777216; |
| 141 | // const int FLAG_BLACK = 33554432; |
| 142 | // const int FLAG_WHITE = 67108864; |
| 143 | // |
| 144 | // |
| 145 | // const int ALGO_FINALPOS = 1; |
| 146 | // const int ALGO_MOVELIST = 2; |
| 147 | // const int ALGO_HASH_FULL_CORNERS = 4; |
| 148 | // const int ALGO_INTERVALS = 8; |
| 149 | // const int ALGO_HASH_CENTER = 16; |
| 150 | // const int ALGO_HASH_SIDES = 3; |
| 151 | // |
| 152 | // // list of implemented algorithms |
| 153 | // |
| 154 | // ALL_ALGOS = { ALGO_FINALPOS: Algo_finalpos, |
| 155 | // ALGO_MOVELIST: Algo_movelist, |
| 156 | // ALGO_HASH_FULL_CORNERS: Algo_hash_full_corners, |
| 157 | // ALGO_INTERVALS: Algo_intervals} |
| 158 | // |
| 159 |
Note: See TracBrowser for help on using the browser.
