| 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 | #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/ |
| 24 | #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/ |
| 25 | #include "matrix.h"cxx . . $ `<file>/src/game_tree/matrix.h`/ |
| 26 | #include "group.h"cxx . . $ `<file>/src/game_tree/group.h`/ |
| 27 | #include "messages.h"cxx . . $ `<file>/src/network/messages.h`/ |
| 28 | #include "sgfparser.h"cxx . . $ `<file>/src/sgf/sgfparser.h`/ |
| 29 | #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/ |
| 30 | |
| 31 | #include <vector> |
| 32 | |
| 33 | #include <QtCore> |
| 34 | |
| 35 | Treecxx . . $ Tree#::Treecxx . . $ Tree#Tree(43c79ee2f1b9aefe).(int board_size, float komi) |
| 36 | : boardSizecxx . . $ Tree#boardSize.(board_size), rootcxx . . $ Tree#root.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!), komicxx . . $ Tree#komi.(komi) |
| 37 | { |
| 38 | initcxx . . $ Tree#init(49f6e7a06ebc5aa8).(); |
| 39 | loadingSGFcxx . . $ Tree#loadingSGF. = false; |
| 40 | } |
| 41 | |
| 42 | void Treecxx . . $ Tree#::initcxx . . $ Tree#init(49f6e7a06ebc5aa8).() |
| 43 | { |
| 44 | if(rootcxx . . $ Tree#root.) |
| 45 | delete rootcxx . . $ Tree#root.; |
| 46 | lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch. = currentcxx . . $ Tree#current. = rootcxx . . $ Tree#root. = new Movecxx . . $ Move#Move(d4f767463ce0a6b3).(boardSizecxx . . $ Tree#boardSize.); |
| 47 | // node index used for IGS review |
| 48 | rootcxx . . $ Tree#root.->setNodeIndexcxx . . $ Move#setNodeIndex(d4f767463ce0a6b3).(1); |
| 49 | } |
| 50 | |
| 51 | Treecxx . . $ Tree#::~cxx . . $ Tree#`~Tree`(ced63f7c635d850d).Treecxx . . $ Tree#() |
| 52 | { |
| 53 | if (rootcxx . . $ Tree#root.) |
| 54 | delete rootcxx . . $ Tree#root.; |
| 55 | } |
| 56 | |
| 57 | /* |
| 58 | * Find a move starting from the given in the argument in the main branch, or at marked move. |
| 59 | */ |
| 60 | Movecxx . . $ Move#* Treecxx . . $ Tree#::findMovecxx . . $ Tree#findMove(5d88c6f2f7d0249f).(Movecxx . . $ Move# *start, int x, int y, bool checkmarker) |
| 61 | { |
| 62 | Movecxx . . $ Move# *t = start; |
| 63 | while (t && (t->getXcxx . . $ Move#getX(455f465bc33b4cdf).() != x || t->getYcxx . . $ Move#getY(455f465bc33b4cdf).() != y)) |
| 64 | { |
| 65 | t = (checkmarker && t->markercxx . . $ Move#marker. ? t->markercxx . . $ Move#marker. : t->soncxx . . $ Move#son.); |
| 66 | } |
| 67 | return t; |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * Find a move starting from the given in the argument in the |
| 72 | * all following branches. |
| 73 | */ |
| 74 | Movecxx . . $ Move#* Treecxx . . $ Tree#::findNodecxx . . $ Tree#findNode(602c32861683a004).(Movecxx . . $ Move# *m, int node) |
| 75 | { |
| 76 | Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(m); |
| 77 | QStackcxx . . $ QStack#<Movecxx . . $ Move#*> stack; |
| 78 | Movecxx . . $ Move# *t = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 79 | |
| 80 | // Traverse the tree and drop every node into stack result |
| 81 | stack.pushcxx . . $ QStack#push(77d9f17553126ecb).(m); |
| 82 | |
| 83 | while (!stack.isEmptycxx . . $ QVector#isEmpty(50ce9a9e25b4a850).()) |
| 84 | { |
| 85 | t = stack.popcxx . . $ QStack#pop(5f357b03ed472e5e).(); |
| 86 | if (t != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 87 | { |
| 88 | if (t->getNodeIndexcxx . . $ Move#getNodeIndex(b126dc7c1de90089).() == node) |
| 89 | return t; |
| 90 | stack.pushcxx . . $ QStack#push(77d9f17553126ecb).(t->brothercxx . . $ Move#brother.); |
| 91 | stack.pushcxx . . $ QStack#push(77d9f17553126ecb).(t->soncxx . . $ Move#son.); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // node index not found |
| 96 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 97 | } |
| 98 | |
| 99 | void Treecxx . . $ Tree#::setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(Movecxx . . $ Move# *m) |
| 100 | { |
| 101 | if (!m || (currentcxx . . $ Tree#current. == m)) |
| 102 | return; |
| 103 | |
| 104 | currentcxx . . $ Tree#current. = m; |
| 105 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! currentMoveChangedcxx . . $ Tree#currentMoveChanged(490cd2a4f5caa810).(currentcxx . . $ Tree#current.); |
| 106 | } |
| 107 | |
| 108 | Movecxx . . $ Move# *Treecxx . . $ Tree#::findLastMoveInMainBranchcxx . . $ Tree#findLastMoveInMainBranch(81447a345d48a217).() |
| 109 | { |
| 110 | return lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch.; |
| 111 | } |
| 112 | |
| 113 | Movecxx . . $ Move# *Treecxx . . $ Tree#::findLastMoveInCurrentBranchcxx . . $ Tree#findLastMoveInCurrentBranch(81447a345d48a217).() |
| 114 | { |
| 115 | Movecxx . . $ Move# *m = getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).(); |
| 116 | if (m) |
| 117 | return m->getLastMovecxx . . $ Move#getLastMove(64a469cb2ad0f61a).(true); |
| 118 | else |
| 119 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 120 | } |
| 121 | |
| 122 | void Treecxx . . $ Tree#::addEmptyMovecxx . . $ Tree#addEmptyMove(49f6e7a06ebc5aa8).() |
| 123 | { |
| 124 | Movecxx . . $ Move# * node = new Movecxx . . $ Move#Move(752bbe91abdcf632).(currentcxx . . $ Tree#current.,stoneBlackcxx . . $ stoneBlack., -1, -1); |
| 125 | node->setTimeinfocxx . . $ Move#setTimeinfo(b45ddcbc8423892c).(false); |
| 126 | currentcxx . . $ Tree#current. = node; |
| 127 | if(currentcxx . . $ Tree#current.->isInMainBranchcxx . . $ Move#isInMainBranch(50ce9a9e25b4a850).()) |
| 128 | lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch. = currentcxx . . $ Tree#current.; |
| 129 | } |
| 130 | |
| 131 | /* FIXME double check and remove editMove, unnecessary */ |
| 132 | void Treecxx . . $ Tree#::doPasscxx . . $ Tree#doPass(b0b38cda41d4ede4).(bool /*sgf*/, bool /*fastLoad*/) |
| 133 | { |
| 134 | /////////////////FIXME We may have a problem at first move with handicap games ... |
| 135 | StoneColorcxx . . $ StoneColor# c = (currentcxx . . $ Tree#current.->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.) ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite.; |
| 136 | Movecxx . . $ Move# *result = currentcxx . . $ Tree#current.->makeMovecxx . . $ Move#makeMove(b73c42e1a544db20).(c, PASS_XYcxx . . $ `src/defines.h:38:9`!, PASS_XYcxx . . $ `src/defines.h:38:9`!); |
| 137 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result); |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | * this deletes the current node an all its sons |
| 142 | */ |
| 143 | void Treecxx . . $ Tree#::deleteNodecxx . . $ Tree#deleteNode(49f6e7a06ebc5aa8).() |
| 144 | { |
| 145 | if (currentcxx . . $ Tree#current. == rootcxx . . $ Tree#root.) |
| 146 | { |
| 147 | initcxx . . $ Tree#init(49f6e7a06ebc5aa8).(); |
| 148 | return; |
| 149 | } |
| 150 | |
| 151 | Movecxx . . $ Move# *remember = currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent.; |
| 152 | delete currentcxx . . $ Tree#current.; |
| 153 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(remember); |
| 154 | if(remember->isInMainBranchcxx . . $ Move#isInMainBranch(50ce9a9e25b4a850).()) |
| 155 | lastMoveInMainBranchcxx . . $ Tree#lastMoveInMainBranch. = remember; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | /* |
| 160 | * Former BoardHandler slots |
| 161 | */ |
| 162 | void Treecxx . . $ Tree#::slotNavForwardcxx . . $ Tree#slotNavForward(49f6e7a06ebc5aa8).() |
| 163 | { |
| 164 | if (rootcxx . . $ Tree#root. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || currentcxx . . $ Tree#current. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || currentcxx . . $ Tree#current.->soncxx . . $ Move#son. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 165 | return; |
| 166 | |
| 167 | if (currentcxx . . $ Tree#current.->markercxx . . $ Move#marker.) |
| 168 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(currentcxx . . $ Tree#current.->markercxx . . $ Move#marker.); |
| 169 | else |
| 170 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(currentcxx . . $ Tree#current.->soncxx . . $ Move#son.); |
| 171 | |
| 172 | currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent.->markercxx . . $ Move#marker. = currentcxx . . $ Tree#current.; // Parents remembers this move we went to |
| 173 | } |
| 174 | |
| 175 | void Treecxx . . $ Tree#::slotNavBackwardcxx . . $ Tree#slotNavBackward(49f6e7a06ebc5aa8).() |
| 176 | { |
| 177 | if (rootcxx . . $ Tree#root. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || currentcxx . . $ Tree#current. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 178 | return; |
| 179 | |
| 180 | currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent.->markercxx . . $ Move#marker. = currentcxx . . $ Tree#current.; // Remember the son we came from |
| 181 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent.); |
| 182 | } |
| 183 | |
| 184 | void Treecxx . . $ Tree#::slotNavFirstcxx . . $ Tree#slotNavFirst(49f6e7a06ebc5aa8).() |
| 185 | { |
| 186 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(rootcxx . . $ Tree#root.); |
| 187 | } |
| 188 | |
| 189 | void Treecxx . . $ Tree#::slotNavLastcxx . . $ Tree#slotNavLast(49f6e7a06ebc5aa8).() |
| 190 | { |
| 191 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(findLastMoveInCurrentBranchcxx . . $ Tree#findLastMoveInCurrentBranch(81447a345d48a217).()); |
| 192 | } |
| 193 | |
| 194 | void Treecxx . . $ Tree#::slotNavPrevCommentcxx . . $ Tree#slotNavPrevComment(49f6e7a06ebc5aa8).() |
| 195 | { |
| 196 | Movecxx . . $ Move# *m = currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent.; |
| 197 | |
| 198 | while (m) |
| 199 | { |
| 200 | if (!(m->getCommentcxx . . $ Move#getComment(d436534e89c8f252).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).())) |
| 201 | break; |
| 202 | m = m->parentcxx . . $ Move#parent.; |
| 203 | } |
| 204 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m); |
| 205 | } |
| 206 | |
| 207 | void Treecxx . . $ Tree#::slotNavNextCommentcxx . . $ Tree#slotNavNextComment(49f6e7a06ebc5aa8).() |
| 208 | { |
| 209 | Movecxx . . $ Move# *m = currentcxx . . $ Tree#current.->soncxx . . $ Move#son.; |
| 210 | |
| 211 | while (m) |
| 212 | { |
| 213 | if (!(m->getCommentcxx . . $ Move#getComment(d436534e89c8f252).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).())) |
| 214 | break; |
| 215 | m = m->soncxx . . $ Move#son.; |
| 216 | } |
| 217 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m); |
| 218 | } |
| 219 | |
| 220 | void Treecxx . . $ Tree#::slotNthMovecxx . . $ Tree#slotNthMove(d4f767463ce0a6b3).(int n) |
| 221 | { |
| 222 | if (n < 0) |
| 223 | return; |
| 224 | |
| 225 | Movecxx . . $ Move# *m = currentcxx . . $ Tree#current.; |
| 226 | |
| 227 | int currentMove = m->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).(); |
| 228 | |
| 229 | while (m && ((currentMove = m->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).()) != n)) |
| 230 | { |
| 231 | if (m->parentcxx . . $ Move#parent.) |
| 232 | m->parentcxx . . $ Move#parent.->markercxx . . $ Move#marker. = m; |
| 233 | if (n > currentMove) |
| 234 | { |
| 235 | m = (m->markercxx . . $ Move#marker. ? m->markercxx . . $ Move#marker. : m->soncxx . . $ Move#son.); |
| 236 | } |
| 237 | else |
| 238 | { |
| 239 | m = m->parentcxx . . $ Move#parent.; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m); |
| 244 | } |
| 245 | |
| 246 | void Treecxx . . $ Tree#::slotNavNextVarcxx . . $ Tree#slotNavNextVar(49f6e7a06ebc5aa8).() |
| 247 | { |
| 248 | if (currentcxx . . $ Tree#current. && currentcxx . . $ Tree#current.->brothercxx . . $ Move#brother.) |
| 249 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(currentcxx . . $ Tree#current.->brothercxx . . $ Move#brother.); |
| 250 | } |
| 251 | |
| 252 | void Treecxx . . $ Tree#::slotNavPrevVarcxx . . $ Tree#slotNavPrevVar(49f6e7a06ebc5aa8).() |
| 253 | { |
| 254 | if (currentcxx . . $ Tree#current. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 255 | return; |
| 256 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(currentcxx . . $ Tree#current.->getPrevBrothercxx . . $ Move#getPrevBrother(81447a345d48a217).()); |
| 257 | } |
| 258 | |
| 259 | void Treecxx . . $ Tree#::slotNavStartVarcxx . . $ Tree#slotNavStartVar(49f6e7a06ebc5aa8).() |
| 260 | { |
| 261 | Movecxx . . $ Move# *m = currentcxx . . $ Tree#current.->parentcxx . . $ Move#parent.; |
| 262 | while (m && !(m->brothercxx . . $ Move#brother.)) |
| 263 | m = m->parentcxx . . $ Move#parent.; |
| 264 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m ? m : rootcxx . . $ Tree#root.); |
| 265 | } |
| 266 | |
| 267 | void Treecxx . . $ Tree#::slotNavNextBranchcxx . . $ Tree#slotNavNextBranch(49f6e7a06ebc5aa8).() |
| 268 | { |
| 269 | Movecxx . . $ Move# *m = currentcxx . . $ Tree#current.; |
| 270 | if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 271 | return; |
| 272 | |
| 273 | // Descend to the next branching point |
| 274 | while (m->soncxx . . $ Move#son. && !(m->brothercxx . . $ Move#brother.)) |
| 275 | m = m->soncxx . . $ Move#son.; |
| 276 | |
| 277 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m); |
| 278 | } |
| 279 | |
| 280 | /* |
| 281 | * This function resumes back to the first move in the main branch |
| 282 | */ |
| 283 | void Treecxx . . $ Tree#::slotNavMainBranchcxx . . $ Tree#slotNavMainBranch(49f6e7a06ebc5aa8).() |
| 284 | { |
| 285 | Movecxx . . $ Move# *m = currentcxx . . $ Tree#current.; |
| 286 | Movecxx . . $ Move# *n = currentcxx . . $ Tree#current.; |
| 287 | while (m->parentcxx . . $ Move#parent.) |
| 288 | { |
| 289 | if (m->parentcxx . . $ Move#parent.->soncxx . . $ Move#son. != m) |
| 290 | n = m->parentcxx . . $ Move#parent.; |
| 291 | m = m->parentcxx . . $ Move#parent.; |
| 292 | } |
| 293 | |
| 294 | if (n == m) |
| 295 | return; |
| 296 | |
| 297 | n->markercxx . . $ Move#marker. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 298 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(n); |
| 299 | } |
| 300 | |
| 301 | /* |
| 302 | * Called after the preceding (slot nav Intersection) |
| 303 | * When the intersection 'x/y' has been clicked on |
| 304 | */ |
| 305 | void Treecxx . . $ Tree#::findMoveByPoscxx . . $ Tree#findMoveByPos(3e454b8ccf442868).(int x, int y) |
| 306 | { |
| 307 | Movecxx . . $ Move# *m = findMoveInMainBranchcxx . . $ Tree#findMoveInMainBranch(c450a16e3b9b3bc9).(x, y); |
| 308 | if(!m) |
| 309 | m=findMoveInCurrentBranchcxx . . $ Tree#findMoveInCurrentBranch(c450a16e3b9b3bc9).(x, y); |
| 310 | |
| 311 | if (m) |
| 312 | setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(m); |
| 313 | } |
| 314 | |
| 315 | /* |
| 316 | * Called by qgoboard when score button is pressed up, leaving score mode |
| 317 | */ |
| 318 | void Treecxx . . $ Tree#::exitScorecxx . . $ Tree#exitScore(49f6e7a06ebc5aa8).() |
| 319 | { |
| 320 | // Remove territory marks |
| 321 | if (currentcxx . . $ Tree#current.->isTerritoryMarkedcxx . . $ Move#isTerritoryMarked(50ce9a9e25b4a850).()) |
| 322 | { |
| 323 | currentcxx . . $ Tree#current.->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->clearTerritoryMarkscxx . . $ Matrix#clearTerritoryMarks(49f6e7a06ebc5aa8).(); |
| 324 | currentcxx . . $ Tree#current.->setTerritoryMarkedcxx . . $ Move#setTerritoryMarked(b45ddcbc8423892c).(false); |
| 325 | currentcxx . . $ Tree#current.->setScoredcxx . . $ Move#setScored(b45ddcbc8423892c).(false); |
| 326 | } |
| 327 | |
| 328 | currentcxx . . $ Tree#current.->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->absMatrixcxx . . $ Matrix#absMatrix(49f6e7a06ebc5aa8).(); |
| 329 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! currentMoveChangedcxx . . $ Tree#currentMoveChanged(490cd2a4f5caa810).(currentcxx . . $ Tree#current.); |
| 330 | } |
| 331 | |
| 332 | bool Treecxx . . $ Tree#::importSGFFilecxx . . $ Tree#importSGFFile(7dc6c9a0b6a7270f).(QStringcxx . . $ QString# filename) |
| 333 | { |
| 334 | SGFParsercxx . . $ SGFParser# *sgfParser = new SGFParsercxx . . $ SGFParser#(this); |
| 335 | QStringcxx . . $ QString# SGFLoaded = sgfParser->loadFilecxx . . $ SGFParser#loadFile(fd988a2ab94d906b).(filename); |
| 336 | return sgfParser->doParsecxx . . $ SGFParser#doParse(e1defb592416720d).(SGFLoaded); |
| 337 | } |
| 338 | |
| 339 | bool Treecxx . . $ Tree#::importSGFStringcxx . . $ Tree#importSGFString(7dc6c9a0b6a7270f).(QStringcxx . . $ QString# SGF) |
| 340 | { |
| 341 | SGFParsercxx . . $ SGFParser# *sgfParser = new SGFParsercxx . . $ SGFParser#(this); |
| 342 | return sgfParser->doParsecxx . . $ SGFParser#doParse(e1defb592416720d).(SGF); |
| 343 | } |
| 344 | |
| 345 | QStringcxx . . $ QString# Treecxx . . $ Tree#::exportSGFStringcxx . . $ Tree#exportSGFString(9f7deeccc2bc8c97).(GameDatacxx . . $ GameData# *gameData) |
| 346 | { |
| 347 | QStringcxx . . $ QString# sgf = ""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 348 | SGFParsercxx . . $ SGFParser# *p = new SGFParsercxx . . $ SGFParser#(this); |
| 349 | p->exportSGFtoClipBcxx . . $ SGFParser#exportSGFtoClipB(dfc9a3f638d89e9e).(&sgf, this, gameData); |
| 350 | delete p; |
| 351 | return sgfcxx . . $ QString#QString(28715ad661ad3cec).; |
| 352 | } |
| 353 | |
| 354 | /* |
| 355 | * Performs all operations on the matrix of current move to display score marks |
| 356 | * and score informaton on the uI |
| 357 | */ |
| 358 | void Treecxx . . $ Tree#::countScorecxx . . $ Tree#countScore(49f6e7a06ebc5aa8).(void) |
| 359 | { |
| 360 | currentcxx . . $ Tree#current.->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->markTerritorycxx . . $ Matrix#markTerritory(49f6e7a06ebc5aa8).(); |
| 361 | currentcxx . . $ Tree#current.->setTerritoryMarkedcxx . . $ Move#setTerritoryMarked(b45ddcbc8423892c).(true); |
| 362 | currentcxx . . $ Tree#current.->setScoredcxx . . $ Move#setScored(b45ddcbc8423892c).(true); |
| 363 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! currentMoveChangedcxx . . $ Tree#currentMoveChanged(490cd2a4f5caa810).(currentcxx . . $ Tree#current.); // Toggles window refresh |
| 364 | |
| 365 | countMarkedcxx . . $ Tree#countMarked(490cd2a4f5caa810).(currentcxx . . $ Tree#current.); |
| 366 | } |
| 367 | |
| 368 | void Treecxx . . $ Tree#::countMarkedcxx . . $ Tree#countMarked(490cd2a4f5caa810).(Movecxx . . $ Move# * mv) |
| 369 | { |
| 370 | deadWhitecxx . . $ Tree#deadWhite. = 0; |
| 371 | deadBlackcxx . . $ Tree#deadBlack. = 0; |
| 372 | terrWhitecxx . . $ Tree#terrWhite. = 0; |
| 373 | terrBlackcxx . . $ Tree#terrBlack. = 0; |
| 374 | capturesBlackcxx . . $ Tree#capturesBlack. = mv->getCapturesBlackcxx . . $ Move#getCapturesBlack(455f465bc33b4cdf).(); |
| 375 | capturesWhitecxx . . $ Tree#capturesWhite. = mv->getCapturesWhitecxx . . $ Move#getCapturesWhite(455f465bc33b4cdf).(); |
| 376 | |
| 377 | mv->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->countcxx . . $ Matrix#count(a90a5d8ba88c22b1).(terrBlackcxx . . $ Tree#terrBlack., terrWhitecxx . . $ Tree#terrWhite., deadBlackcxx . . $ Tree#deadBlack., deadWhitecxx . . $ Tree#deadWhite.); |
| 378 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Tree::countMarked():" <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). terrBlackcxx . . $ Tree#terrBlack. <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). capturesBlackcxx . . $ Tree#capturesBlack. <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). deadWhitecxx . . $ Tree#deadWhite. <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). terrWhitecxx . . $ Tree#terrWhite. <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). capturesWhitecxx . . $ Tree#capturesWhite. <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). deadBlackcxx . . $ Tree#deadBlack.; |
| 379 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! scoreChangedcxx . . $ Tree#scoreChanged(4df37d5d0c1dcce).(terrBlackcxx . . $ Tree#terrBlack., capturesBlackcxx . . $ Tree#capturesBlack., deadWhitecxx . . $ Tree#deadWhite., |
| 380 | terrWhitecxx . . $ Tree#terrWhite., capturesWhitecxx . . $ Tree#capturesWhite., deadBlackcxx . . $ Tree#deadBlack.); |
| 381 | } |
| 382 | |
| 383 | /* Not totally confident that this belongs here, but |
| 384 | * the score is counted here */ |
| 385 | GameResultcxx . . $ GameResult# Treecxx . . $ Tree#::retrieveScorecxx . . $ Tree#retrieveScore(ba5abcee0082dfc2).(void) |
| 386 | { |
| 387 | GameResultcxx . . $ GameResult# gcxx . . $ GameResult#GameResult(49f6e7a06ebc5aa8).; |
| 388 | g.resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::SCOREcxx . . $ GameResult#SCORE.; |
| 389 | /* What about different scoring types? (chinese versus japanese) |
| 390 | * FIXME This basically confirms for me that this does not |
| 391 | * belong here */ |
| 392 | |
| 393 | float blackScore = terrBlackcxx . . $ Tree#terrBlack. + capturesBlackcxx . . $ Tree#capturesBlack. + deadWhitecxx . . $ Tree#deadWhite.; |
| 394 | float whiteScore = terrWhitecxx . . $ Tree#terrWhite. + capturesWhitecxx . . $ Tree#capturesWhite. + deadBlackcxx . . $ Tree#deadBlack. + komicxx . . $ Tree#komi.; |
| 395 | if(whiteScore > blackScore) |
| 396 | { |
| 397 | g.winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.; |
| 398 | g.winner_scorecxx . . $ GameResult#winner_score. = whiteScore; |
| 399 | g.loser_scorecxx . . $ GameResult#loser_score. = blackScore; |
| 400 | } |
| 401 | else |
| 402 | { |
| 403 | g.winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.; |
| 404 | g.winner_scorecxx . . $ GameResult#winner_score. = blackScore; |
| 405 | g.loser_scorecxx . . $ GameResult#loser_score. = whiteScore; |
| 406 | } |
| 407 | return g; |
| 408 | } |