Debian Codegraph @

src/game_interfaces/qgoboardlocalinterface.cpp

raw symbols SCIP
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 #include "qgoboardlocalinterface.h"cxx . . $ `<file>/src/game_interfaces/qgoboardlocalinterface.h`/
23
24 #include "qgtp.h"cxx . . $ `<file>/src/gtp/qgtp.h`/
25 #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/
26 #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/
27 #include "../network/messages.h"cxx . . $ `<file>/src/network/messages.h`/
28 #include "gamedata.h"cxx . . $ `<file>/src/gamedata.h`/
29 #include "boardwindow.h"cxx . . $ `<file>/src/board/boardwindow.h`/
30 #include "qgtp.h"cxx . . $ `<file>/src/gtp/qgtp.h`/
31 #include "board.h"cxx . . $ `<file>/src/board/board.h`/
32 #include "matrix.h"cxx . . $ `<file>/src/game_tree/matrix.h`/
33 #include "audio.h"cxx . . $ `<file>/src/audio/audio.h`/
34
35 #include <QMessageBox>
36
37 qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#qGoBoardLocalInterface(29a441517101e16e).(BoardWindowcxx . . $ BoardWindow# *bw, Treecxx . . $ Tree# * t, GameDatacxx . . $ GameData# *gd)
38 : qGoBoardcxx . . $ qGoBoard#(bw, t, gd)
39 {
40 this->setObjectNamecxx . . $ QObject#setObjectName(3520e46b33348bf6).("qGoBoardLocalInterface"cxx . . $ QString#QString(85c52e162fed56f9).);
41 boardwindowcxx . . $ qGoBoard#boardwindow.->clearDatacxx . . $ BoardWindow#clearData(49f6e7a06ebc5aa8).();
42
43 // If we have handicap, but not from a loaded file, we have to set the handicap move
44 if (gameDatacxx . . $ qGoBoard#gameData.->handicapcxx . . $ GameData#handicap. && gameDatacxx . . $ qGoBoard#gameData.->fileNamecxx . . $ GameData#fileName..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).())
45 setHandicapcxx . . $ qGoBoard#setHandicap(d4f767463ce0a6b3).(gameDatacxx . . $ qGoBoard#gameData.->handicapcxx . . $ GameData#handicap.);
46
47 QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
48 // value 1 = no sound, 0 all games, 2 my games
49 playSoundcxx . . $ qGoBoard#playSound. = (settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("SOUND"cxx . . $ QString#QString(85c52e162fed56f9).) !=cxx . . $ QVariant#`operator!=`(d03696648ee9d662). 1cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).);
50
51 // Set up computer interface.
52 gtpcxx . . $ qGoBoardLocalInterface#gtp. = new QGtpcxx . . $ QGtp#QGtp(49f6e7a06ebc5aa8).();
53 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
54
55 connectcxx . . $ QObject#connect(835f87066c895669). (gtpcxx . . $ qGoBoardLocalInterface#gtp., &QGtpcxx . . $ QGtp#::signal_computerPlayedcxx . . $ QGtp#signal_computerPlayed(3e454b8ccf442868)., this, &qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slot_playComputercxx . . $ qGoBoardLocalInterface#slot_playComputer(3e454b8ccf442868).);
56 connectcxx . . $ QObject#connect(835f87066c895669). (gtpcxx . . $ qGoBoardLocalInterface#gtp., &QGtpcxx . . $ QGtp#::computerResignedcxx . . $ QGtp#computerResigned(49f6e7a06ebc5aa8)., this, &qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slot_resignComputercxx . . $ qGoBoardLocalInterface#slot_resignComputer(49f6e7a06ebc5aa8).);
57 connectcxx . . $ QObject#connect(835f87066c895669). (gtpcxx . . $ qGoBoardLocalInterface#gtp., &QGtpcxx . . $ QGtp#::computerPassedcxx . . $ QGtp#computerPassed(49f6e7a06ebc5aa8)., this, &qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slot_passComputercxx . . $ qGoBoardLocalInterface#slot_passComputer(49f6e7a06ebc5aa8).);
58
59
60 settings.beginReadArraycxx . . $ QSettings#beginReadArray(645d6210e0be3a78).("ENGINES"cxx . . $ QString#QString(85c52e162fed56f9).);
61 settings.setArrayIndexcxx . . $ QSettings#setArrayIndex(d4f767463ce0a6b3).(settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("DEFAULT_ENGINE"cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).());
62 QStringcxx . . $ QString# path = settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("path"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
63 QStringcxx . . $ QString# args = settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("args"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
64 settings.endArraycxx . . $ QSettings#endArray(49f6e7a06ebc5aa8).();
65 if (gtpcxx . . $ qGoBoardLocalInterface#gtp.->openGtpSessioncxx . . $ QGtp#openGtpSession(18a8b0c0b3bf543a).(pathcxx . . $ QString#QString(132dd6869045752b).,argscxx . . $ QString#QString(132dd6869045752b).,
66 gameDatacxx . . $ qGoBoard#gameData.->board_sizecxx . . $ GameData#board_size.,
67 gameDatacxx . . $ qGoBoard#gameData.->komicxx . . $ GameData#komi.,
68 gameDatacxx . . $ qGoBoard#gameData.->handicapcxx . . $ GameData#handicap.)==FAILcxx . . $ `src/gtp/qgtp.h:26:9`!)
69 {
70 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(0,QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Error"),
71 QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Error opening program: %1").argcxx . . $ QString#arg(bc823072288cbbb5).(gtpcxx . . $ qGoBoardLocalInterface#gtp.->getLastMessagecxx . . $ QGtp#getLastMessage(4365c3963150523e).()));
72 delete gtpcxx . . $ qGoBoardLocalInterface#gtp.;
73 gtpcxx . . $ qGoBoardLocalInterface#gtp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
74 }
75
76 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->findLastMoveInMainBranchcxx . . $ Tree#findLastMoveInMainBranch(81447a345d48a217).());
77
78 insertStoneFlagcxx . . $ qGoBoardLocalInterface#insertStoneFlag. = false;
79 feedPositionThroughGtpcxx . . $ qGoBoardLocalInterface#feedPositionThroughGtp(49f6e7a06ebc5aa8).();
80 }
81
82 qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::~cxx . . $ qGoBoardLocalInterface#`~qGoBoardLocalInterface`(ced63f7c635d850d).qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#()
83 {
84 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Deconstructing computer interface");
85 delete gtpcxx . . $ qGoBoardLocalInterface#gtp.;
86 }
87
88 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::localMoveRequestcxx . . $ qGoBoardLocalInterface#localMoveRequest(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y)
89 {
90 if (insertStoneFlagcxx . . $ qGoBoardLocalInterface#insertStoneFlag.)
91 {
92 treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).()->insertStonecxx . . $ Matrix#insertStone(adfa9924dba61c7b).(x,y,c,true);
93 return;
94 }
95 bool engineUpToDate = (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).() == currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.);
96 Movecxx . . $ Move# *result = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->hasSoncxx . . $ Move#hasSon(1b9ccd6dde28afc7).(c,x,y);
97 if (!result)
98 result = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->makeMovecxx . . $ Move#makeMove(b73c42e1a544db20).(c,x,y);
99 if (!result)
100 return;
101
102 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result);
103 setModifiedcxx . . $ qGoBoard#setModified(b45ddcbc8423892c).(true);
104 boardwindowcxx . . $ qGoBoard#boardwindow.->updateMovecxx . . $ BoardWindow#updateMove(490cd2a4f5caa810).(treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).());
105
106 /* Non trivial here. We don't want to play a sound as we get all
107 * the moves from an observed game. But there's no clean way
108 * to tell when the board has stopped loading, particularly for IGS.
109 * so we only play a sound every 250 msecs...
110 * Also, maybe it should play even if we aren't looking at last move, yeah not sure on that FIXME */
111 if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseOngoingcxx . . $ phaseOngoing. && playSoundcxx . . $ qGoBoard#playSound.)
112 {
113 clickSoundcxx . . $ qGoBoard#clickSound.->playcxx . . $ Sound#play(49f6e7a06ebc5aa8).();
114 }
115
116 if (engineUpToDate)
117 {
118 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = result;
119 sendMoveToInterfacecxx . . $ qGoBoardLocalInterface#sendMoveToInterface(e6b2860cd25699f2).(c,x,y);
120 }
121 else
122 feedPositionThroughGtpcxx . . $ qGoBoardLocalInterface#feedPositionThroughGtp(49f6e7a06ebc5aa8).();
123
124 return;
125 }
126
127
128 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slotDonePressedcxx . . $ qGoBoardLocalInterface#slotDonePressed(49f6e7a06ebc5aa8).()
129 {
130 /* FIXME Since there's no server to tell us the result, we have
131 * to calculate it or whatever, print out a winner a score, etc..
132 * I'm really surprised there's no existing code to do this
133 * actually. Also feels like the kind of thing that could
134 * be in qGoBoard, some generic win reporting thing, score
135 * reporting, etc.. and then the set_result functions could
136 * call that qGoBoard thing with the specifics.*/
137 qGoBoardcxx . . $ qGoBoard#::slotDonePressedcxx . . $ qGoBoard#slotDonePressed(49f6e7a06ebc5aa8).();
138 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Done Pressed\n");
139 }
140
141 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slotUndoPressedcxx . . $ qGoBoardLocalInterface#slotUndoPressed(49f6e7a06ebc5aa8).()
142 {
143 if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.)
144 leaveScoreModecxx . . $ qGoBoardLocalInterface#leaveScoreMode(49f6e7a06ebc5aa8).();
145 else
146 {
147 if (gtpcxx . . $ qGoBoardLocalInterface#gtp.)
148 gtpcxx . . $ qGoBoardLocalInterface#gtp.->undocxx . . $ QGtp#undo(7864480464b09eea).(0);
149 qGoBoardcxx . . $ qGoBoard#::slotUndoPressedcxx . . $ qGoBoard#slotUndoPressed(49f6e7a06ebc5aa8).();
150 }
151 }
152
153 /*
154 * This sends the move to the computer through GTP
155 */
156 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::sendMoveToInterfacecxx . . $ qGoBoardLocalInterface#sendMoveToInterface(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c,int x, int y)
157 {
158 if (!gtpcxx . . $ qGoBoardLocalInterface#gtp.)
159 return;
160 switch (c)
161 {
162 case stoneWhitecxx . . $ stoneWhite. :
163 if (gtpcxx . . $ qGoBoardLocalInterface#gtp.->playwhitecxx . . $ QGtp#playwhite(9b79fb6aee4c0440).(x ,y))
164 {
165 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., PACKAGEcxx . . $ `src/defines.h:32:9`!, trcxx . . $ qGoBoardLocalInterface#tr(75d9f1c324b4579d).("Failed to play the stone within program \n") +cxx . . $ operator+(fab9b4f80031f353). gtpcxx . . $ qGoBoardLocalInterface#gtp.->getLastMessagecxx . . $ QGtp#getLastMessage(4365c3963150523e).());
166 return;
167 }
168 break;
169
170 case stoneBlackcxx . . $ stoneBlack. :
171 if (gtpcxx . . $ qGoBoardLocalInterface#gtp.->playblackcxx . . $ QGtp#playblack(9b79fb6aee4c0440).(x ,y))
172 {
173 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., PACKAGEcxx . . $ `src/defines.h:32:9`!, trcxx . . $ qGoBoardLocalInterface#tr(75d9f1c324b4579d).("Failed to play the stone within program \n") +cxx . . $ operator+(fab9b4f80031f353). gtpcxx . . $ qGoBoardLocalInterface#gtp.->getLastMessagecxx . . $ QGtp#getLastMessage(4365c3963150523e).());
174 return;
175 }
176 break;
177
178 default :
179 ;
180 }
181
182 // Check whether the computer should reply
183 checkComputersTurncxx . . $ qGoBoardLocalInterface#checkComputersTurn(b45ddcbc8423892c).();
184 }
185
186 /*
187 * This slot is triggered by the signal emitted by 'gtp' when getting a move
188 */
189 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slot_playComputercxx . . $ qGoBoardLocalInterface#slot_playComputer(3e454b8ccf442868).(int x, int y)
190 {
191 bool atCurrent = (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).() == currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.);
192 Movecxx . . $ Move# *result = currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.->makeMovecxx . . $ Move#makeMove(b73c42e1a544db20).(currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.->whoIsOnTurncxx . . $ Move#whoIsOnTurn(5202307a42d70465).(), x, y);
193 if (!result)
194 {
195 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardLocalInterface#tr(75d9f1c324b4579d).("Invalid Move"), trcxx . . $ qGoBoardLocalInterface#tr(75d9f1c324b4579d).("The incoming move (%1, %2) seems to be invalid").argcxx . . $ QString#arg(64ab2ed17cc11715).(x).argcxx . . $ QString#arg(64ab2ed17cc11715).(y));
196 return;
197 }
198 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = result;
199
200 if (atCurrent)
201 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result);
202 checkComputersTurncxx . . $ qGoBoardLocalInterface#checkComputersTurn(b45ddcbc8423892c).();
203 }
204
205 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slot_resignComputercxx . . $ qGoBoardLocalInterface#slot_resignComputer(49f6e7a06ebc5aa8).()
206 {
207 // This hack should be removed by making doMove() and related functions relative to a move
208 Movecxx . . $ Move# *remember = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).();
209 bool atCurrent = (remember == currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.);
210 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.);
211
212 bool b = getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).();
213 GameResultcxx . . $ GameResult# gcxx . . $ GameResult#GameResult(8260daab7d234241).((!b ? stoneBlackcxx . . $ stoneBlack. : stoneWhitecxx . . $ stoneWhite.), GameResultcxx . . $ GameResult#::RESIGNcxx . . $ GameResult#RESIGN.);
214 setResultcxx . . $ qGoBoard#setResult(cbc950be3aaaa49b).(g);
215 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
216
217 if (!atCurrent)
218 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(remember);
219 }
220
221 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slot_passComputercxx . . $ qGoBoardLocalInterface#slot_passComputer(49f6e7a06ebc5aa8).()
222 {
223 bool atCurrent = (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).() == currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.);
224 Movecxx . . $ Move# *result = currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.->makePasscxx . . $ Move#makePass(81447a345d48a217).();
225 if (!result)
226 return;
227 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = result;
228
229 if (result->parentcxx . . $ Move#parent.->isPassMovecxx . . $ Move#isPassMove(c9857a73d68e59ba).())
230 {
231 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result);
232 enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).();
233 } else {
234 if (atCurrent)
235 treecxx . . $ qGoBoard#tree.->setCurrentcxx . . $ Tree#setCurrent(490cd2a4f5caa810).(result);
236 checkComputersTurncxx . . $ qGoBoardLocalInterface#checkComputersTurn(b45ddcbc8423892c).();
237 }
238 }
239
240 /*
241 * sends a "pass" move to GTP
242 */
243 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::passRequestcxx . . $ qGoBoardLocalInterface#passRequest(49f6e7a06ebc5aa8).()
244 {
245 if (getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).())
246 {
247 doPasscxx . . $ qGoBoard#doPass(42096433316d3db3).();
248 if (gtpcxx . . $ qGoBoardLocalInterface#gtp.)
249 gtpcxx . . $ qGoBoardLocalInterface#gtp.->playblackPasscxx . . $ QGtp#playblackPass(b126dc7c1de90089).();
250 } else if (!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).())
251 {
252 doPasscxx . . $ qGoBoard#doPass(42096433316d3db3).();
253 if (gtpcxx . . $ qGoBoardLocalInterface#gtp.)
254 gtpcxx . . $ qGoBoardLocalInterface#gtp.->playwhitePasscxx . . $ QGtp#playwhitePass(b126dc7c1de90089).();
255 } else
256 return; // It is not our move
257
258 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).();
259 if (treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).()->parentcxx . . $ Move#parent.->isPassMovecxx . . $ Move#isPassMove(c9857a73d68e59ba).())
260 enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).();
261 else
262 checkComputersTurncxx . . $ qGoBoardLocalInterface#checkComputersTurn(b45ddcbc8423892c).();
263 }
264
265 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::feedPositionThroughGtpcxx . . $ qGoBoardLocalInterface#feedPositionThroughGtp(49f6e7a06ebc5aa8).()
266 {
267 if (!gtpcxx . . $ qGoBoardLocalInterface#gtp.)
268 return;
269 gtpcxx . . $ qGoBoardLocalInterface#gtp.->clearBoardcxx . . $ QGtp#clearBoard(b126dc7c1de90089).();
270
271 QStackcxx . . $ QStack#<Movecxx . . $ Move#*> stack;
272 Movecxx . . $ Move# *m = treecxx . . $ qGoBoard#tree.->getCurrentcxx . . $ Tree#getCurrent(8db4894deadf6b2c).();
273 currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine. = m;
274 while (m->parentcxx . . $ Move#parent. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
275 {
276 stack.pushcxx . . $ QStack#push(77d9f17553126ecb).(m);
277 m = m->parentcxx . . $ Move#parent.;
278 }
279 // Do not push the root move.
280 // It only holds the handicap (if any).
281 if (treecxx . . $ qGoBoard#tree.->getRootcxx . . $ Tree#getRoot(8db4894deadf6b2c).()->isHandicapMovecxx . . $ Move#isHandicapMove(c9857a73d68e59ba).())
282 {
283 Matrixcxx . . $ Matrix# * m = treecxx . . $ qGoBoard#tree.->getRootcxx . . $ Tree#getRoot(8db4894deadf6b2c).()->getMatrixcxx . . $ Move#getMatrix(a22259058712982).();
284 int size = m->getSizecxx . . $ Matrix#getSize(455f465bc33b4cdf).();
285 QListcxx . . $ QList#<Pointcxx . . $ Point#> handicap_stonescxx . . $ QList#QList(ced63f7c635d850d).;
286 for (int x=1; x<=size; x++)
287 for (int y=1; y<=size; y++)
288 {
289 if (m->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x,y) == stoneBlackcxx . . $ stoneBlack.)
290 handicap_stones.appendcxx . . $ QList#append(77d9f17553126ecb).(Pointcxx . . $ Point#Point(f2aedcda44a3e977).(x,y));
291 }
292 gtpcxx . . $ qGoBoardLocalInterface#gtp.->set_free_handicapcxx . . $ QGtp#set_free_handicap(c73e7c52a16cf11a).(handicap_stonescxx . . $ QList#QList(3d2301cfd89f773a).);
293 }
294
295 while (!stack.isEmptycxx . . $ QVector#isEmpty(50ce9a9e25b4a850).())
296 {
297 m = stack.popcxx . . $ QStack#pop(5f357b03ed472e5e).();
298 if (m->isPassMovecxx . . $ Move#isPassMove(c9857a73d68e59ba).())
299 {
300 if (m->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneBlackcxx . . $ stoneBlack.)
301 gtpcxx . . $ qGoBoardLocalInterface#gtp.->playblackPasscxx . . $ QGtp#playblackPass(b126dc7c1de90089).();
302 else if (m->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.)
303 gtpcxx . . $ qGoBoardLocalInterface#gtp.->playwhitePasscxx . . $ QGtp#playwhitePass(b126dc7c1de90089).();
304 } else {
305 if (m->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneWhitecxx . . $ stoneWhite.)
306 gtpcxx . . $ qGoBoardLocalInterface#gtp.->playwhitecxx . . $ QGtp#playwhite(9b79fb6aee4c0440).(m->getXcxx . . $ Move#getX(455f465bc33b4cdf).(), m->getYcxx . . $ Move#getY(455f465bc33b4cdf).());
307 else if (m->getColorcxx . . $ Move#getColor(6680c74b05d375a4).() == stoneBlackcxx . . $ stoneBlack.)
308 gtpcxx . . $ qGoBoardLocalInterface#gtp.->playblackcxx . . $ QGtp#playblack(9b79fb6aee4c0440).(m->getXcxx . . $ Move#getX(455f465bc33b4cdf).(), m->getYcxx . . $ Move#getY(455f465bc33b4cdf).());
309 }
310 }
311 // Request a move if the computer is on turn
312 checkComputersTurncxx . . $ qGoBoardLocalInterface#checkComputersTurn(b45ddcbc8423892c).();
313 }
314
315 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::checkComputersTurncxx . . $ qGoBoardLocalInterface#checkComputersTurn(b45ddcbc8423892c).(bool force)
316 {
317 if ((!gtpcxx . . $ qGoBoardLocalInterface#gtp.) || (gtpcxx . . $ qGoBoardLocalInterface#gtp.->isBusycxx . . $ QGtp#isBusy(c9857a73d68e59ba).()) || (!currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.))
318 return;
319
320 StoneColorcxx . . $ StoneColor# toPlay = currentEnginecxx . . $ qGoBoardLocalInterface#currentEngine.->whoIsOnTurncxx . . $ Move#whoIsOnTurn(5202307a42d70465).();
321 int result = OKcxx . . $ `src/gtp/qgtp.h:25:9`!;
322 if ((toPlay == stoneBlackcxx . . $ stoneBlack.) && (force || !(boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).())))
323 result= gtpcxx . . $ qGoBoardLocalInterface#gtp.->genmoveBlackcxx . . $ QGtp#genmoveBlack(b126dc7c1de90089).();
324 else if ((toPlay == stoneWhitecxx . . $ stoneWhite.) && (force || !(boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).())))
325 result = gtpcxx . . $ qGoBoardLocalInterface#gtp.->genmoveWhitecxx . . $ QGtp#genmoveWhite(b126dc7c1de90089).();
326
327 if (result == FAILcxx . . $ `src/gtp/qgtp.h:26:9`!)
328 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., PACKAGEcxx . . $ `src/defines.h:32:9`!, trcxx . . $ qGoBoardLocalInterface#tr(75d9f1c324b4579d).("Move request from engine failed\n") +cxx . . $ operator+(fab9b4f80031f353). gtpcxx . . $ qGoBoardLocalInterface#gtp.->getLastMessagecxx . . $ QGtp#getLastMessage(4365c3963150523e).());
329 }
330
331 void qGoBoardLocalInterfacecxx . . $ qGoBoardLocalInterface#::slotToggleInsertStonescxx . . $ qGoBoardLocalInterface#slotToggleInsertStones(b45ddcbc8423892c).(bool val)
332 {
333 insertStoneFlagcxx . . $ qGoBoardLocalInterface#insertStoneFlag. = val;
334 }