| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2009 by The qGo Project * |
| 3 | * * |
| 4 | * This file is part of qGo. * |
| 5 | * * |
| 6 | * qGo is free software: you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, see <http://www.gnu.org/licenses/> * |
| 18 | * or write to the Free Software Foundation, Inc., * |
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | |
| 23 | #ifndef MATRIX_H |
| 24 | #define MATRIX_Hcxx . . $ `src/game_tree/matrix.h:24:9`! |
| 25 | |
| 26 | #include "defines.h"cxx . . $ `<file>/src/defines.h`/ |
| 27 | |
| 28 | /* |
| 29 | * Marks used in editing a game |
| 30 | */ |
| 31 | #define MARK_TERRITORY_VISITEDcxx . . $ `src/game_tree/matrix.h:31:9`! 0x1000 |
| 32 | |
| 33 | //first nibble is for stone color/erase |
| 34 | #define MX_STONEDEADcxx . . $ `src/game_tree/matrix.h:34:9`! 0x8000 |
| 35 | #define MX_STONEEDITcxx . . $ `src/game_tree/matrix.h:35:9`! 0x4000 |
| 36 | |
| 37 | #define MX_VISITEDcxx . . $ `src/game_tree/matrix.h:37:9`! 0x2000 |
| 38 | |
| 39 | class Groupcxx . . $ Group#; |
| 40 | |
| 41 | struct ASCII_Importcxx . . $ ASCII_Import# |
| 42 | { |
| 43 | char blackStonecxx . . $ ASCII_Import#blackStone., whiteStonecxx . . $ ASCII_Import#whiteStone., starPointcxx . . $ ASCII_Import#starPoint., emptyPointcxx . . $ ASCII_Import#emptyPoint., hBordercxx . . $ ASCII_Import#hBorder., vBordercxx . . $ ASCII_Import#vBorder.; |
| 44 | }; |
| 45 | |
| 46 | class Matrixcxx . . $ Matrix# |
| 47 | { |
| 48 | public: |
| 49 | Matrixcxx . . $ Matrix#Matrix(d4f767463ce0a6b3).(int s=DEFAULT_BOARD_SIZEcxx . . $ `src/defines.h:35:9`!); |
| 50 | Matrixcxx . . $ Matrix#Matrix(6427e280fdeb4614).(const Matrixcxx . . $ Matrix# &m, bool cleanup = false); |
| 51 | ~cxx . . $ Matrix#`~Matrix`(49f6e7a06ebc5aa8).Matrixcxx . . $ Matrix#(); |
| 52 | int getSizecxx . . $ Matrix#getSize(455f465bc33b4cdf).() const { return sizecxx . . $ Matrix#size.; } |
| 53 | void insertStonecxx . . $ Matrix#insertStone(adfa9924dba61c7b).(int x, int y, StoneColorcxx . . $ StoneColor# c, bool fEdit = false); |
| 54 | StoneColorcxx . . $ StoneColor# getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(int x, int y); |
| 55 | bool isStoneDeadcxx . . $ Matrix#isStoneDead(cf9ef193275fa6d8).(int x, int y); |
| 56 | MarkTypecxx . . $ MarkType# getMarkAtcxx . . $ Matrix#getMarkAt(cd452d1956ab952a).(int x, int y); |
| 57 | QStringcxx . . $ QString# getFirstTextAvailablecxx . . $ Matrix#getFirstTextAvailable(86e5271f0d39a332).(MarkTypecxx . . $ MarkType# t); |
| 58 | |
| 59 | void insertMarkcxx . . $ Matrix#insertMark(2fb52c50f1893bf2).(int x, int y, MarkTypecxx . . $ MarkType# t); |
| 60 | void removeMarkcxx . . $ Matrix#removeMark(3e454b8ccf442868).(int x, int y); |
| 61 | void setMarkTextcxx . . $ Matrix#setMarkText(c89d651b24440698).(int x, int y, const QStringcxx . . $ QString# &txt); |
| 62 | const QStringcxx . . $ QString# getMarkTextcxx . . $ Matrix#getMarkText(ff5dcb9213a676d0).(int x, int y); |
| 63 | void clearAllMarkscxx . . $ Matrix#clearAllMarks(49f6e7a06ebc5aa8).(); |
| 64 | void clearTerritoryMarkscxx . . $ Matrix#clearTerritoryMarks(49f6e7a06ebc5aa8).(); |
| 65 | void absMatrixcxx . . $ Matrix#absMatrix(49f6e7a06ebc5aa8).(); |
| 66 | const QStringcxx . . $ QString# saveMarkscxx . . $ Matrix#saveMarks(ea4b39313763ec41).(); |
| 67 | const QStringcxx . . $ QString# saveEditedMovescxx . . $ Matrix#saveEditedMoves(58a83039bbc051dc).(Matrixcxx . . $ Matrix# *parent=0); |
| 68 | const QStringcxx . . $ QString# printMecxx . . $ Matrix#printMe(32757fa23de63b9d).(ASCII_Importcxx . . $ ASCII_Import# *charset); |
| 69 | |
| 70 | int checkStoneCapturescxx . . $ Matrix#checkStoneCaptures(3f4db0380f904985).(StoneColorcxx . . $ StoneColor# ourColor, int x, int y, stdcxx . . $ std/::vectorcxx . . $ std/vector#<Groupcxx . . $ Group# *> &visited) const; |
| 71 | void removeGroupcxx . . $ Matrix#removeGroup(91c185f55c453815).(Groupcxx . . $ Group# * g); |
| 72 | |
| 73 | void toggleGroupAtcxx . . $ Matrix#toggleGroupAt(3e454b8ccf442868).( int x, int y ); |
| 74 | void toggleStoneAtcxx . . $ Matrix#toggleStoneAt(3e454b8ccf442868).(int x, int y); |
| 75 | void markStoneDeadcxx . . $ Matrix#markStoneDead(3e454b8ccf442868).(int x, int y); |
| 76 | void markGroupDeadcxx . . $ Matrix#markGroupDead(3e454b8ccf442868).(int x, int y); |
| 77 | void markGroupAlivecxx . . $ Matrix#markGroupAlive(3e454b8ccf442868).(int x, int y); |
| 78 | void toggleAreaAtcxx . . $ Matrix#toggleAreaAt(3e454b8ccf442868).( int x, int y ); |
| 79 | void markAreaDeadcxx . . $ Matrix#markAreaDead(3e454b8ccf442868).(int x, int y); |
| 80 | void markAreaAlivecxx . . $ Matrix#markAreaAlive(3e454b8ccf442868).(int x, int y); |
| 81 | void markTerritorycxx . . $ Matrix#markTerritory(49f6e7a06ebc5aa8).(); |
| 82 | void countcxx . . $ Matrix#count(a90a5d8ba88c22b1).(int & terrBlack, int & terrWhite, int & deadBlack, int & deadWhite); |
| 83 | |
| 84 | static const QStringcxx . . $ QString# coordsToStringcxx . . $ Matrix#coordsToString(ff5dcb9213a676d0).(int x, int y) |
| 85 | { return QStringcxx . . $ QString#QString(f2c90172ce699d92).(QCharcxx . . $ QChar#(static_cast<const char>('a' + x))).appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(QCharcxx . . $ QChar#(static_cast<const char>('a' + y))); } |
| 86 | |
| 87 | int makeMovecxx . . $ Matrix#makeMove(bed22547599c466d).(int x, int y, StoneColorcxx . . $ StoneColor# c); |
| 88 | bool addHandicapStonescxx . . $ Matrix#addHandicapStones(83c267b20bac841a).(int handicap); |
| 89 | |
| 90 | private: |
| 91 | int internalCoordsToKeycxx . . $ Matrix#internalCoordsToKey(adc74905ab378dc7).(int i, int j) const { return i*sizecxx . . $ Matrix#size. + j; } |
| 92 | int coordsToKeycxx . . $ Matrix#coordsToKey(adc74905ab378dc7).(int x, int y) const { return internalCoordsToKeycxx . . $ Matrix#internalCoordsToKey(adc74905ab378dc7).(x-1,y-1); } |
| 93 | void keyToCoordscxx . . $ Matrix#keyToCoords(b65a193129228544).(int key, int &x, int &y) const |
| 94 | { x = key / sizecxx . . $ Matrix#size.; y = key - (x++)*sizecxx . . $ Matrix#size. + 1; } |
| 95 | |
| 96 | StoneColorcxx . . $ StoneColor# getStoneAtcxx . . $ Matrix#getStoneAt(5e71495a53a18c05).(int key) const; |
| 97 | MarkTypecxx . . $ MarkType# getMarkAtcxx . . $ Matrix#getMarkAt(49bf564c8ddc54a6).(int key) const; |
| 98 | void insertStonecxx . . $ Matrix#insertStone(86392494ac0cc61f).(int key, StoneColorcxx . . $ StoneColor# c, bool fEdit = false); |
| 99 | Groupcxx . . $ Group#* assembleGroupcxx . . $ Matrix#assembleGroup(19a7d4c00f8ff9f6).(int key, StoneColorcxx . . $ StoneColor# c) const; |
| 100 | void toggleStoneAtcxx . . $ Matrix#toggleStoneAt(d4f767463ce0a6b3).(int key); |
| 101 | |
| 102 | void checkNeighbourcxx . . $ Matrix#checkNeighbour(1d8d88c027dffa2).(int key, StoneColorcxx . . $ StoneColor# color, Groupcxx . . $ Group# *group, stdcxx . . $ std/::vectorcxx . . $ std/vector#<int> * libertyList = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) const; |
| 103 | int countLibertiescxx . . $ Matrix#countLiberties(52b9dbe09fcca159).(Groupcxx . . $ Group# *group, unsigned short mask = stoneBlackcxx . . $ stoneBlack.|stoneWhitecxx . . $ stoneWhite.); |
| 104 | Groupcxx . . $ Group#* assembleAreaGroupscxx . . $ Matrix#assembleAreaGroups(93920e3289793f04).(int key, StoneColorcxx . . $ StoneColor# c); |
| 105 | // This function returns a list of keys of points adjacent to the point "key". |
| 106 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<int> getNeighborscxx . . $ Matrix#getNeighbors(bf04f17e6fc0658e).(int key) const; |
| 107 | void floodTerritorycxx . . $ Matrix#floodTerritory(cde69bbbe2f15639).(unsigned short mark, int key); |
| 108 | |
| 109 | unsigned short * matrixcxx . . $ Matrix#matrix.; |
| 110 | const int sizecxx . . $ Matrix#size.; |
| 111 | QHashcxx . . $ QHash#<int,QStringcxx . . $ QString#> markTextscxx . . $ Matrix#markTexts.; |
| 112 | }; |
| 113 | |
| 114 | #endif |