1
/***************************************************************************
4
begin : Thu Nov 29 2001
5
copyright : (C) 2001 by PALM Thomas , DINTILHAC Florian, HIVERT Anthony, PIOC Sebastien
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
22
//#include <qprocess.h>
23
enum CommandType {PROTOCOL, BOARDSIZE, KNOWN_COMMAND, LEVEL, KOMI, PLAY_BLACK, PLAY_WHITE, GENMOVE};
30
/* Function: open a session
31
* Arguments: name and path of go program
37
/*openGtpSession(filename);*/
38
programProcess = NULL; // This to permit proper ending
39
responseReceived = FALSE;
46
programProcess->kill(); // not very clean (should use tryTerminate)
51
/* Function: get the last message from gnugo
54
* Returns: last message from GO
58
QString QGtp::getLastMessage()
63
int QGtp::openGtpSession(QString filename, int size, float komi, int handicap, int /*level*/)
67
programProcess = new QProcess();
68
QStringList arguments;
73
_response = "No go engine path set";
77
if (filename.toLower().contains("gnugo"))
79
arguments << "--mode" << "gtp" << "--quiet" ;
83
if (filename.toLower().contains("mogo"))
85
arguments << "--19" << "--dontDisplay" << "1" ;
90
connect(programProcess, SIGNAL(readyRead()),
91
this, SLOT(slot_readFromStdout()) );
92
connect(programProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
93
this, SLOT(slot_processExited(int , QProcess::ExitStatus )) );
95
qDebug("starting Go engine : %s %s", filename.toLatin1().constData(), arguments.join(" ").toLatin1().constData());
97
programProcess->start(filename, arguments);
101
if (!programProcess->waitForStarted())
103
_response="Could not start "+filename;
107
//?? never know ... otherwise, I get a segfault with sprint ...
108
if ((outFile = (char *)malloc (100)) == NULL)
110
_response="Yuck ! Could not allocate 100 bytes !!!" ;
114
if (protocolVersion()==OK)
116
if(getLastMessage().toInt() !=2)
118
qDebug("Protocol version problem???");
120
_response="Protocol version not supported";
123
if(setBoardsize(size)==FAIL)
127
if(clearBoard()==FAIL)
129
// removed by frosla -> protocol changes...
134
if(knownCommand("level")==FAIL)
139
else if (getLastMessage().contains("true"))
141
if (setLevel(level)==FAIL)
148
if(setKomi(komi)==FAIL)
153
if(fixedHandicap(handicap)==FAIL)
161
_response="Protocol version error";
169
void QGtp::slot_readFromStdout()
177
s = programProcess->readAllStandardOutput();
179
} while (!s.isEmpty());
180
if(answer[answer.length() - 1] != '\n')
182
responseReceived = TRUE;
184
answer=answer.trimmed();
185
if (answer.length() != 0)
191
if(buff != "=" && buff != "?")
193
responseReceived = FALSE;
197
// do we have any answer after the command number ?
198
pos = _response.indexOf(" ");
199
number = _response.mid(1,pos).toInt();
204
_response = _response.right(_response.length() - pos - 1);
207
qDebug("** QGtp::slot_read(): \'%s\'" , _response.toLatin1().constData());
213
emit signal_computerPlayed( (buff != "?") , _response );
214
responseReceived = FALSE;
222
void QGtp::slot_processExited(int exitCode, QProcess::ExitStatus exitStatus)
224
qDebug("Process Exited with exit code %i and status %d", exitCode, exitStatus);
225
// sprintf (outFile, "%d quit\n", _cpt);
226
// sprintf (outFile, "quit\n");
228
// return waitResponse();
231
/* Function: wait for a go response
239
QString buf = _response;
240
// QTextStream * inFile;
244
do //FIXME : we don't nned this, since the process sends the readyRead signal
246
qApp->processEvents();
253
} while (!responseReceived/*_response.length() == 0 || _response == buf*/);
255
inFile=new QTextStream(programProcess->readStdout(),IO_ReadOnly);
260
buff=inFile->readLine();
261
} while(number !=_cpt);
264
// _response=buff.stripWhiteSpace();
267
buff=programProcess->readLineStdout();
268
while(!buff.isEmpty())
270
_response=_response+"\n"+buff;
271
buff=programProcess->readLineStdout();
276
if ((pos = _response.indexOf(" ")) < 1)
278
number = _response.mid(1,pos).toInt();
279
_response = _response.right(_response.length() - pos - 1);
281
qDebug("** QGtp::waitResponse(): \'%s\'" , _response.toLatin1().constData());
282
responseReceived = FALSE;
284
if (buff == "?") //symbole=='?')
294
/****************************
295
* Program identity. *
296
****************************/
298
/* Function: Report the name of the program.
301
* Returns: program name
306
qDebug("%d name",_cpt);
307
sprintf (outFile, "%d name\n", _cpt);
309
return waitResponse();
312
/* Function: Report protocol version.
315
* Returns: protocol version number
318
QGtp::protocolVersion ()
320
qDebug("%d protocol_version",_cpt);
322
sprintf (outFile, "%d protocol_version\n", /*_cpt*/ PROTOCOL);
324
sprintf (outFile, "protocol_version\n");
327
return waitResponse();
330
void QGtp::fflush(char * s)
333
int msglen = strlen(s);
335
QByteArray dat(msglen);
336
for (int j = 0; j < msglen; j++) {
339
programProcess->writeToStdin(dat);
343
qDebug("flush -> %s",s);
344
uint i= programProcess->write(QByteArray(s));
346
// int j= programProcess->waitForBytesWritten ( 100 );
349
qDebug("Error writing %s",s);
354
/****************************
355
* Administrative commands. *
356
****************************/
366
// sprintf (outFile, "%d quit\n", _cpt);
367
sprintf (outFile, "quit\n");
369
return waitResponse();
372
/* Function: Report the version number of the program.
375
* Returns: version number
380
// sprintf (outFile, "%d version\n", _cpt);
381
sprintf (outFile,"version\n");
383
return waitResponse();
387
/***************************
388
* Setting the board size. *
389
***************************/
391
/* Function: Set the board size to NxN.
393
* Fails: board size outside engine's limits
397
QGtp::setBoardsize (int size)
400
sprintf (outFile, "%d boardsize %d\n", BOARDSIZE /*_cpt*/, size);
402
sprintf (outFile, "boardsize %d\n", size);
404
return waitResponse();
408
/* Function: Find the current boardsize
411
* Returns: board_size
414
QGtp::queryBoardsize()
416
sprintf (outFile, "%d query_boardsize\n", _cpt);
418
return waitResponse();
421
/***********************
422
* Clearing the board. *
423
***********************/
425
/* Function: Clear the board.
435
// sprintf (outFile, "%d clear_board\n", _cpt);
437
sprintf (outFile,"clear_board\n");
439
return waitResponse();
442
/***************************
444
***************************/
446
/* Function: Set the komi.
448
* Fails: incorrect argument
452
QGtp::setKomi(float f)
455
sprintf (outFile, "%d komi %.2f\n", KOMI /*_cpt*/,f);
457
sprintf (outFile, "komi %.2f\n", f);
459
return waitResponse();
462
/* Function: Set the playing level.
464
* Fails: incorrect argument
468
QGtp::setLevel (int level)
470
sprintf (outFile, "%d level %d\n", _cpt,level);
472
return waitResponse();
478
/* Function: Play a black stone at the given vertex.
480
* Fails: invalid vertex, illegal move
484
QGtp::playblack (char c , int i)
486
// sprintf (outFile, "%d play black %c%d\n", _cpt,c,i);
488
sprintf (outFile, "%d play black %c%d\n", PLAY_BLACK/*_cpt*/,c,i);
490
sprintf (outFile, "play black %c%d\n", c,i);
492
return waitResponse();
495
/* Function: Black pass.
501
QGtp::playblackPass ()
503
// sprintf (outFile, "%d play black pass\n", _cpt);
505
sprintf (outFile, "%d play black pass\n", PLAY_BLACK /*_cpt*/);
507
sprintf (outFile, "play black pass\n");
509
return waitResponse();
512
/* Function: Play a white stone at the given vertex.
514
* Fails: invalid vertex, illegal move
518
QGtp::playwhite (char c, int i)
520
// sprintf (outFile, "%d play white %c%d\n", _cpt,c,i);
522
sprintf (outFile, "%d play white %c%d\n", PLAY_WHITE /*_cpt*/,c,i);
524
sprintf (outFile, "play white %c%d\n", c,i);
526
return waitResponse();
529
/* Function: White pass.
535
QGtp::playwhitePass ()
537
// sprintf (outFile, "%d play white pass\n", _cpt);
539
sprintf (outFile, "%d play white pass\n",PLAY_WHITE /*_cpt*/);
541
sprintf (outFile, "play white pass\n");
543
return waitResponse();
546
/* Function: Set up fixed placement handicap stones.
547
* Arguments: number of handicap stones
548
* Fails: invalid number of stones for the current boardsize
549
* Returns: list of vertices with handicap stones
552
QGtp::fixedHandicap (int handicap)
558
sprintf (outFile, "%d fixed_handicap %d\n", _cpt,handicap);
560
sprintf (outFile, "fixed_handicap %d\n",handicap);
563
return waitResponse();
566
/* Function: Load an sgf file, possibly up to a move number or the first
567
* occurence of a move.
568
* Arguments: filename + move number, vertex, or nothing
569
* Fails: missing filename or failure to open or parse file
570
* Returns: color to play
572
int QGtp::loadsgf (QString filename,int /*movNumber*/,char /*c*/,int /*i*/)
574
//sprintf (outFile, "%d loadsgf %s %d %c%d\n", _cpt,(const char *) filename,movNumber,c,i);
575
qDebug("**QGtp::loadsgf : loading file %s", filename.toLatin1().constData());
576
sprintf (outFile, "%d loadsgf %s\n", _cpt,filename.toLatin1().constData());
578
return waitResponse();
585
/* Function: Return the color at a vertex.
587
* Fails: invalid vertex
588
* Returns: "black", "white", or "empty"
591
QGtp::whatColor (char c, int i)
593
sprintf (outFile, "%d color %c%d\n", _cpt,c,i);
595
return waitResponse();
598
/* Function: Count number of liberties for the string at a vertex.
600
* Fails: invalid vertex, empty vertex
601
* Returns: Number of liberties.
604
QGtp::countlib (char c, int i)
606
sprintf (outFile, "%d countlib %c%d\n", _cpt,c,i);
608
return waitResponse();
611
/* Function: Return the positions of the liberties for the string at a vertex.
613
* Fails: invalid vertex, empty vertex
614
* Returns: Sorted space separated list of vertices.
617
QGtp::findlib (char c, int i)
619
sprintf (outFile, "%d findlib %c%d\n", _cpt,c,i);
621
return waitResponse();
624
/* Function: Tell whether a move is legal.
626
* Fails: invalid move
627
* Returns: 1 if the move is legal, 0 if it is not.
630
QGtp::isLegal (QString color, char c, int i)
632
sprintf (outFile, "%d is_legal %s %c%d\n", _cpt,color.toLatin1().constData(),c,i);
634
return waitResponse();
637
/* Function: List all legal moves for either color.
639
* Fails: invalid color
640
* Returns: Sorted space separated list of vertices.
643
QGtp::allLegal (QString color)
645
sprintf (outFile, "%d all_legal %s\n", _cpt,color.toLatin1().constData());
647
return waitResponse();
650
/* Function: List the number of captures taken by either color.
652
* Fails: invalid color
653
* Returns: Number of captures.
656
QGtp::captures (QString color)
658
sprintf (outFile, "%d captures %s\n", _cpt,color.toLatin1().constData());
660
return waitResponse();
663
/**********************
664
* Retractable moves. *
665
**********************/
667
/* Function: Play a stone of the given color at the given vertex.
668
* Arguments: move (color + vertex)
669
* Fails: invalid color, invalid vertex, illegal move
673
QGtp::trymove (QString color, char c, int i)
675
sprintf (outFile, "%d trymove %s %c%d\n", _cpt,color.toLatin1().constData(),c,i);
677
return waitResponse();
680
/* Function: Undo a trymove.
688
sprintf (outFile, "%d popgo\n", _cpt);
690
return waitResponse();
693
/*********************
694
* Tactical reading. *
695
*********************/
697
/* Function: Try to attack a string.
699
* Fails: invalid vertex, empty vertex
700
* Returns: attack code followed by attack point if attack code nonzero.
703
QGtp::attack (char c, int i)
705
sprintf (outFile, "%d attack %c%d\n", _cpt,c,i);
707
return waitResponse();
710
/* Function: Try to defend a string.
712
* Fails: invalid vertex, empty vertex
713
* Returns: defense code followed by defense point if defense code nonzero.
716
QGtp::defend (char c, int i)
718
sprintf (outFile, "%d defend %c%d\n", _cpt,c,i);
720
return waitResponse();
723
/* Function: Increase depth values by one.
729
QGtp::increaseDepths ()
731
sprintf (outFile, "%d increase_depths\n", _cpt);
733
return waitResponse();
736
/* Function: Decrease depth values by one.
742
QGtp::decreaseDepths ()
744
sprintf (outFile, "%d decrease_depths\n", _cpt);
746
return waitResponse();
753
/* Function: Try to attack a dragon.
755
* Fails: invalid vertex, empty vertex
756
* Returns: attack code followed by attack point if attack code nonzero.
759
QGtp::owlAttack (char c, int i)
761
sprintf (outFile, "%d owl_attack %c%d\n", _cpt,c,i);
763
return waitResponse();
766
/* Function: Try to defend a dragon.
768
* Fails: invalid vertex, empty vertex
769
* Returns: defense code followed by defense point if defense code nonzero.
772
QGtp::owlDefend (char c, int i)
774
sprintf (outFile, "%d owl_defend %c%d\n", _cpt,c,i);
776
return waitResponse();
783
/* Function: Evaluate an eye space
785
* Fails: invalid vertex
786
* Returns: Minimum and maximum number of eyes. If these differ an
787
* attack and a defense point are additionally returned.
788
* If the vertex is not an eye space or not of unique color,
789
* a single -1 is returned.
793
QGtp::evalEye (char c, int i)
795
sprintf (outFile, "%d eval_eye %c%d\n", _cpt,c,i);
797
return waitResponse();
804
/* Function: Determine status of a dragon.
806
* Fails: invalid vertex, empty vertex
807
* Returns: status ("alive", "critical", "dead", or "unknown"),
808
* attack point, defense point. Points of attack and
809
* defense are only given if the status is critical and the
810
* owl code is enabled.
812
* FIXME: Should be able to distinguish between life in seki
813
* and life with territory. Should also be able to identify ko.
817
QGtp::dragonStatus (char c, int i)
819
sprintf (outFile, "%d dragon_status %c%d\n", _cpt,c,i);
821
return waitResponse();
824
/* Function: Determine whether two stones belong to the same dragon.
825
* Arguments: vertex, vertex
826
* Fails: invalid vertex, empty vertex
827
* Returns: 1 if the vertices belong to the same dragon, 0 otherwise
831
QGtp::sameDragon (char c1, int i1, char c2, int i2)
833
sprintf (outFile, "%d same_dragon %c%d %c%d\n", _cpt,c1,i1,c2,i2);
835
return waitResponse();
838
/* Function: Return the information in the dragon data structure.
841
* Returns: Dragon data formatted in the corresponding way to gtp_worm__
846
sprintf (outFile, "%d dragon_data \n", _cpt);
848
return waitResponse();
851
/* Function: Return the information in the dragon data structure.
852
* Arguments: intersection
853
* Fails: invalid coordinate
854
* Returns: Dragon data formatted in the corresponding way to gtp_worm__
857
QGtp::dragonData (char c,int i)
859
sprintf (outFile, "%d dragon_data %c%d\n", _cpt,c,i);
861
return waitResponse();
864
/***********************
865
* combination attacks *
866
***********************/
868
/* Function: Find a move by color capturing something through a
869
* combination attack.
871
* Fails: invalid color
872
* Returns: Recommended move, PASS if no move found
876
QGtp::combinationAttack (QString color)
878
sprintf (outFile, "%d combination_attack %s\n", _cpt,color.toLatin1().constData());
880
return waitResponse();
883
/********************
885
********************/
887
/* Function: Generate and play the supposedly best black move.
890
* Returns: a move coordinate (or "PASS")
893
QGtp::genmoveBlack ()
896
sprintf (outFile, "%d genmove black\n", GENMOVE);
898
sprintf (outFile, "genmove black\n");
902
emit signal_computerPlayed( (buff != "?") , _response );
903
// responseReceived = FALSE;
908
/* Function: Generate and play the supposedly best white move.
911
* Returns: a move coordinate (or "PASS")
914
QGtp::genmoveWhite ()
917
sprintf (outFile, "%d genmove white\n", GENMOVE);
919
sprintf (outFile, "genmove white\n");
923
emit signal_computerPlayed( (buff != "?") , _response );
924
// responseReceived = FALSE;
929
/* Function: Generate the supposedly best move for either color.
930
* Arguments: color to move, optionally a random seed
931
* Fails: invalid color
932
* Returns: a move coordinate (or "PASS")
935
QGtp::genmove (QString color,int seed)
937
sprintf (outFile, "%d gg_genmove %s %d\n", _cpt,color.toLatin1().constData(),seed);
939
return waitResponse();
942
/* Function : Generate a list of the best moves for White with weights
945
* Returns : list of moves with weights
949
QGtp::topMovesWhite ()
951
sprintf (outFile, "%d top_moves_white\n", _cpt);
953
return waitResponse();
956
/* Function : Generate a list of the best moves for Black with weights
959
* Returns : list of moves with weights
963
QGtp::topMovesBlack ()
965
sprintf (outFile, "%d top_moves_black\n", _cpt);
967
return waitResponse();
970
/* Function: Undo last move
972
* Fails: If move pointer is 0
978
sprintf (outFile, "%d undo %d\n", _cpt,i);
980
return waitResponse();
983
/* Function: Report the final status of a vertex in a finished game.
984
* Arguments: Vertex, optional random seed
985
* Fails: invalid vertex
986
* Returns: Status in the form of one of the strings "alive", "dead",
987
* "seki", "white_territory", "black_territory", or "dame".
990
QGtp::finalStatus (char c, int i, int seed)
992
sprintf (outFile, "%d final_status %c%d %d\n", _cpt,c,i,seed);
994
return waitResponse();
997
/* Function: Report vertices with a specific final status in a finished game.
998
* Arguments: Status in the form of one of the strings "alive", "dead",
999
* "seki", "white_territory", "black_territory", or "dame".
1000
* An optional random seed can be added.
1001
* Fails: missing or invalid status string
1002
* Returns: Vertices having the specified status. These are split with
1003
* one string on each line if the vertices are nonempty (i.e.
1004
* for "alive", "dead", and "seki").
1007
QGtp::finalStatusList (QString status, int seed)
1009
sprintf (outFile, "%d final_status_list %s %d\n", _cpt,status.toLatin1().constData(),seed);
1011
return waitResponse();
1018
/* Function: Compute the score of a finished game.
1019
* Arguments: Optional random seed
1021
* Returns: Score in SGF format (RE property).
1024
QGtp::finalScore (int seed)
1026
sprintf (outFile, "%d final_score %d\n", _cpt,seed);
1028
return waitResponse();
1032
QGtp::estimateScore ()
1034
sprintf (outFile, "%d estimate_score\n", _cpt);
1036
return waitResponse();
1042
sprintf (outFile, "%d new_score \n", _cpt);
1044
return waitResponse();
1051
/* Function: Reset the count of life nodes.
1057
QGtp::resetLifeNodeCounter ()
1059
sprintf (outFile, "%d reset_life_node_counter\n", _cpt);
1061
return waitResponse();
1064
/* Function: Retrieve the count of life nodes.
1067
* Returns: number of life nodes
1070
QGtp::getLifeNodeCounter ()
1072
sprintf (outFile, "%d get_life_node_counter\n", _cpt);
1074
return waitResponse();
1077
/* Function: Reset the count of owl nodes.
1083
QGtp::resetOwlNodeCounter ()
1085
sprintf (outFile, "%d reset_owl_node_counter\n", _cpt);
1087
return waitResponse();
1090
/* Function: Retrieve the count of owl nodes.
1093
* Returns: number of owl nodes
1096
QGtp::getOwlNodeCounter ()
1098
sprintf (outFile, "%d get_owl_node_counter\n", _cpt);
1100
return waitResponse();
1103
/* Function: Reset the count of reading nodes.
1109
QGtp::resetReadingNodeCounter ()
1111
sprintf (outFile, "%d reset_reading_node_counter\n", _cpt);
1113
return waitResponse();
1116
/* Function: Retrieve the count of reading nodes.
1119
* Returns: number of reading nodes
1122
QGtp::getReadingNodeCounter ()
1124
sprintf (outFile, "%d get_reading_node_counter\n", _cpt);
1126
return waitResponse();
1129
/* Function: Reset the count of trymoves/trykos.
1135
QGtp::resetTrymoveCounter ()
1137
sprintf (outFile, "%d reset_trymove_counter\n", _cpt);
1139
return waitResponse();
1142
/* Function: Retrieve the count of trymoves/trykos.
1145
* Returns: number of trymoves/trykos
1148
QGtp::getTrymoveCounter ()
1150
sprintf (outFile, "%d get_trymove_counter\n", _cpt);
1152
return waitResponse();
1159
/* Function: Write the position to stderr.
1167
sprintf (outFile, "%d showboard\n", _cpt);
1169
return waitResponse();
1172
/* Function: Dump stack to stderr.
1180
sprintf (outFile, "%d dump_stack\n", _cpt);
1182
return waitResponse();
1185
/* Function: Write information about the influence function to stderr.
1186
* Arguments: color to move, optionally a list of what to show
1187
* Fails: invalid color
1191
QGtp::debugInfluence (QString color,QString list)
1193
sprintf (outFile, "%d debug_influence %s %s\n", _cpt,color.toLatin1().constData(),list.toLatin1().constData());
1195
return waitResponse();
1198
/* Function: Write information about the influence function after making
1200
* Arguments: move, optionally a list of what to show
1205
QGtp::debugMoveInfluence (QString color, char c, int i,QString list)
1207
sprintf (outFile, "%d debug_move_influence %s %c%d %s\n", _cpt,color.toLatin1().constData(),c,i,list.toLatin1().constData());
1209
return waitResponse();
1212
/* Function: Return information about the influence function.
1213
* Arguments: color to move
1215
* Returns: Influence data formatted
1218
QGtp::influence (QString color)
1220
sprintf (outFile, "%d influence %s\n", _cpt,color.toLatin1().constData());
1222
return waitResponse();
1225
/* Function: Return information about the influence function after a move
1228
* Returns: Influence data formatted in the same way as for gtp_influence.
1231
QGtp::moveInfluence (QString color, char c, int i)
1233
sprintf (outFile, "%d move_influence %s %c%d\n", _cpt,color.toLatin1().constData(),c,i);
1235
return waitResponse();
1238
/* Function: Return the information in the worm data structure.
1241
* Returns: Worm data formatted
1246
sprintf (outFile, "%d worm_data\n", _cpt);
1248
return waitResponse();
1251
/* Function: Return the information in the worm data structure.
1254
* Returns: Worm data formatted
1257
QGtp::wormData (char c, int i)
1259
sprintf (outFile, "%d worm_data %c%d\n", _cpt,c,i);
1261
return waitResponse();
1264
/* Function: Return the cutstone field in the worm data structure.
1265
* Arguments: non-empty vertex
1270
QGtp::wormCutstone (char c, int i)
1272
sprintf (outFile, "%d worm_cutstone %c%d\n", _cpt,c,i);
1274
return waitResponse();
1277
/* Function: Tune the parameters for the move ordering in the tactical
1279
* Arguments: MOVE_ORDERING_PARAMETERS integers
1280
* Fails: incorrect arguments
1284
QGtp::tuneMoveOrdering (int MOVE_ORDERING_PARAMETERS)
1286
sprintf (outFile, "%d tune_move_ordering %d\n", _cpt,MOVE_ORDERING_PARAMETERS);
1288
return waitResponse();
1291
/* Function: Echo the parameter
1297
QGtp::echo (QString param)
1299
sprintf (outFile, "%d echo %s\n", _cpt,param.toLatin1().constData());
1301
return waitResponse();
1304
/* Function: List all known commands
1307
* Returns: list of known commands, one per line
1312
sprintf (outFile, "%d help\n", _cpt);
1314
return waitResponse();
1317
/* Function: evaluate wether a command is known
1318
* Arguments: command word
1320
* Returns: true or false
1323
QGtp::knownCommand (QString s)
1325
sprintf (outFile, "%d known_command %s\n", _cpt,s.toLatin1().constData());
1327
return waitResponse();
1330
/* Function: Turn uncertainty reports from owl_attack
1331
* and owl_defend on or off.
1332
* Arguments: "on" or "off"
1333
* Fails: invalid argument
1337
QGtp::reportUncertainty (QString s)
1339
sprintf (outFile, "%d report_uncertainty %s\n", _cpt,s.toLatin1().constData());
1341
return waitResponse();
1344
/* Function: List the stones of a worm
1345
* Arguments: the location
1346
* Fails: if called on an empty or off-board location
1347
* Returns: list of stones
1352
sprintf (outFile, "%d worm_stones\n", _cpt);
1354
return waitResponse();
1358
QGtp::shell(QString s)
1360
sprintf (outFile, "%d %s\n", _cpt, s.toLatin1().constData());
1362
return waitResponse();