📄 qgtp.cpp
字号:
*/intQGtp::increaseDepths (){ sprintf (outFile, "%d increase_depths\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Decrease depth values by one.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::decreaseDepths (){ sprintf (outFile, "%d decrease_depths\n", _cpt); fflush(outFile); return waitResponse();}/******************* owl reading. *******************//* Function: Try to attack a dragon.* Arguments: vertex* Fails: invalid vertex, empty vertex* Returns: attack code followed by attack point if attack code nonzero.*/intQGtp::owlAttack (char c, int i){ sprintf (outFile, "%d owl_attack %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/* Function: Try to defend a dragon.* Arguments: vertex* Fails: invalid vertex, empty vertex* Returns: defense code followed by defense point if defense code nonzero.*/intQGtp::owlDefend (char c, int i){ sprintf (outFile, "%d owl_defend %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/********* eyes *********//* Function: Evaluate an eye space* Arguments: vertex* Fails: invalid vertex* Returns: Minimum and maximum number of eyes. If these differ an* attack and a defense point are additionally returned.* If the vertex is not an eye space or not of unique color,* a single -1 is returned.*/intQGtp::evalEye (char c, int i){ sprintf (outFile, "%d eval_eye %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/****************** dragon status ******************//* Function: Determine status of a dragon.* Arguments: vertex* Fails: invalid vertex, empty vertex* Returns: status ("alive", "critical", "dead", or "unknown"),* attack point, defense point. Points of attack and* defense are only given if the status is critical and the* owl code is enabled.** FIXME: Should be able to distinguish between life in seki* and life with territory. Should also be able to identify ko.*/intQGtp::dragonStatus (char c, int i){ sprintf (outFile, "%d dragon_status %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/* Function: Determine whether two stones belong to the same dragon.* Arguments: vertex, vertex* Fails: invalid vertex, empty vertex* Returns: 1 if the vertices belong to the same dragon, 0 otherwise*/intQGtp::sameDragon (char c1, int i1, char c2, int i2){ sprintf (outFile, "%d same_dragon %c%d %c%d\n", _cpt,c1,i1,c2,i2); fflush(outFile); return waitResponse();}/* Function: Return the information in the dragon data structure.* Arguments: nothing* Fails: never* Returns: Dragon data formatted in the corresponding way to gtp_worm__*/intQGtp::dragonData (){ sprintf (outFile, "%d dragon_data \n", _cpt); fflush(outFile); return waitResponse();}/* Function: Return the information in the dragon data structure.* Arguments: intersection* Fails: invalid coordinate* Returns: Dragon data formatted in the corresponding way to gtp_worm__*/intQGtp::dragonData (char c,int i){ sprintf (outFile, "%d dragon_data %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/************************ combination attacks ************************//* Function: Find a move by color capturing something through a* combination attack.* Arguments: color* Fails: invalid color* Returns: Recommended move, PASS if no move found*/intQGtp::combinationAttack (QString color){ sprintf (outFile, "%d combination_attack %s\n", _cpt,(const char *)color); fflush(outFile); return waitResponse();}/********************* generating moves *********************//* Function: Generate and play the supposedly best black move.* Arguments: none* Fails: never* Returns: a move coordinate (or "PASS")*/intQGtp::genmoveBlack (){ sprintf (outFile, "%d genmove black\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Generate and play the supposedly best white move.* Arguments: none* Fails: never* Returns: a move coordinate (or "PASS")*/intQGtp::genmoveWhite (){ sprintf (outFile, "%d genmove white\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Generate the supposedly best move for either color.* Arguments: color to move, optionally a random seed* Fails: invalid color* Returns: a move coordinate (or "PASS")*/intQGtp::genmove (QString color,int seed){ sprintf (outFile, "%d gg_genmove %s %d\n", _cpt,(const char *)color,seed); fflush(outFile); return waitResponse();}/* Function : Generate a list of the best moves for White with weights* Arguments: none* Fails: : never* Returns : list of moves with weights*/intQGtp::topMovesWhite (){ sprintf (outFile, "%d top_moves_white\n", _cpt); fflush(outFile); return waitResponse();}/* Function : Generate a list of the best moves for Black with weights* Arguments: none* Fails: : never* Returns : list of moves with weights*/intQGtp::topMovesBlack (){ sprintf (outFile, "%d top_moves_black\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Undo last move* Arguments: int* Fails: If move pointer is 0* Returns: nothing*/intQGtp::undo (int i){ sprintf (outFile, "%d undo %d\n", _cpt,i); fflush(outFile); return waitResponse();}/* Function: Report the final status of a vertex in a finished game.* Arguments: Vertex, optional random seed* Fails: invalid vertex* Returns: Status in the form of one of the strings "alive", "dead",* "seki", "white_territory", "black_territory", or "dame".*/intQGtp::finalStatus (char c, int i, int seed) { sprintf (outFile, "%d final_status %c%d %d\n", _cpt,c,i,seed); fflush(outFile); return waitResponse();}/* Function: Report vertices with a specific final status in a finished game.* Arguments: Status in the form of one of the strings "alive", "dead",* "seki", "white_territory", "black_territory", or "dame".* An optional random seed can be added.* Fails: missing or invalid status string* Returns: Vertices having the specified status. These are split with* one string on each line if the vertices are nonempty (i.e.* for "alive", "dead", and "seki").*/intQGtp::finalStatusList (QString status, int seed){ sprintf (outFile, "%d final_status_list %s %d\n", _cpt,(const char *)status,seed); fflush(outFile); return waitResponse();}/*************** score ***************//* Function: Compute the score of a finished game.* Arguments: Optional random seed* Fails: never* Returns: Score in SGF format (RE property).*/intQGtp::finalScore (int seed){ sprintf (outFile, "%d final_score %d\n", _cpt,seed); fflush(outFile); return waitResponse();}intQGtp::estimateScore (){ sprintf (outFile, "%d estimate_score\n", _cpt); fflush(outFile); return waitResponse();}intQGtp::newScore (){ sprintf (outFile, "%d new_score \n", _cpt); fflush(outFile); return waitResponse();}/*************** statistics ***************//* Function: Reset the count of life nodes.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::resetLifeNodeCounter (){ sprintf (outFile, "%d reset_life_node_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Retrieve the count of life nodes.* Arguments: none* Fails: never* Returns: number of life nodes*/intQGtp::getLifeNodeCounter (){ sprintf (outFile, "%d get_life_node_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Reset the count of owl nodes.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::resetOwlNodeCounter (){ sprintf (outFile, "%d reset_owl_node_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Retrieve the count of owl nodes.* Arguments: none* Fails: never* Returns: number of owl nodes*/intQGtp::getOwlNodeCounter (){ sprintf (outFile, "%d get_owl_node_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Reset the count of reading nodes.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::resetReadingNodeCounter (){ sprintf (outFile, "%d reset_reading_node_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Retrieve the count of reading nodes.* Arguments: none* Fails: never* Returns: number of reading nodes*/intQGtp::getReadingNodeCounter (){ sprintf (outFile, "%d get_reading_node_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Reset the count of trymoves/trykos.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::resetTrymoveCounter (){ sprintf (outFile, "%d reset_trymove_counter\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Retrieve the count of trymoves/trykos.* Arguments: none* Fails: never* Returns: number of trymoves/trykos*/intQGtp::getTrymoveCounter (){ sprintf (outFile, "%d get_trymove_counter\n", _cpt); fflush(outFile); return waitResponse();}/********** debug **********//* Function: Write the position to stderr.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::showboard (){ sprintf (outFile, "%d showboard\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Dump stack to stderr.* Arguments: none* Fails: never* Returns: nothing*/intQGtp::dumpStack (){ sprintf (outFile, "%d dump_stack\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Write information about the influence function to stderr.* Arguments: color to move, optionally a list of what to show* Fails: invalid color* Returns: nothing*/intQGtp::debugInfluence (QString color,QString list){ sprintf (outFile, "%d debug_influence %s %s\n", _cpt,(const char *)color,(const char *)list); fflush(outFile); return waitResponse();}/* Function: Write information about the influence function after making* a move to stderr.* Arguments: move, optionally a list of what to show* Fails: never* Returns: nothing*/intQGtp::debugMoveInfluence (QString color, char c, int i,QString list){ sprintf (outFile, "%d debug_move_influence %s %c%d %s\n", _cpt,(const char *)color,c,i,(const char *)list); fflush(outFile); return waitResponse();}/* Function: Return information about the influence function.* Arguments: color to move* Fails: never* Returns: Influence data formatted*/intQGtp::influence (QString color){ sprintf (outFile, "%d influence %s\n", _cpt,(const char *)color); fflush(outFile); return waitResponse();}/* Function: Return information about the influence function after a move* Arguments: move* Fails: never* Returns: Influence data formatted in the same way as for gtp_influence.*/intQGtp::moveInfluence (QString color, char c, int i){ sprintf (outFile, "%d move_influence %s %c%d\n", _cpt,(const char *)color,c,i); fflush(outFile); return waitResponse();}/* Function: Return the information in the worm data structure.* Arguments: none* Fails: never* Returns: Worm data formatted*/intQGtp::wormData (){ sprintf (outFile, "%d worm_data\n", _cpt); fflush(outFile); return waitResponse();}/* Function: Return the information in the worm data structure.* Arguments: vertex* Fails: never* Returns: Worm data formatted*/intQGtp::wormData (char c, int i){ sprintf (outFile, "%d worm_data %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/* Function: Return the cutstone field in the worm data structure.* Arguments: non-empty vertex* Fails: never* Returns: cutstone*/intQGtp::wormCutstone (char c, int i){ sprintf (outFile, "%d worm_cutstone %c%d\n", _cpt,c,i); fflush(outFile); return waitResponse();}/* Function: Tune the parameters for the move ordering in the tactical* reading.* Arguments: MOVE_ORDERING_PARAMETERS integers* Fails: incorrect arguments* Returns: nothing*/intQGtp::tuneMoveOrdering (int MOVE_ORDERING_PARAMETERS){ sprintf (outFile, "%d tune_move_ordering %d\n", _cpt,MOVE_ORDERING_PARAMETERS); fflush(outFile); return waitResponse();}/* Function: Echo the parameter* Arguments: string* Fails: never* Returns: nothing*/intQGtp::echo (QString param){ sprintf (outFile, "%d echo %s\n", _cpt,(const char *)param); fflush(outFile); return waitResponse();}/* Function: List all known commands* Arguments: none* Fails: never* Returns: list of known commands, one per line*/intQGtp::help (){ sprintf (outFile, "%d help\n", _cpt); fflush(outFile); return waitResponse();}/* Function: evaluate wether a command is known* Arguments: command word* Fails: never* Returns: true or false*/intQGtp::knownCommand (QString s){ sprintf (outFile, "%d known_command %s\n", _cpt,(const char *)s); fflush(outFile); return waitResponse();}/* Function: Turn uncertainty reports from owl_attack* and owl_defend on or off.* Arguments: "on" or "off"* Fails: invalid argument* Returns: nothing*/intQGtp::reportUncertainty (QString s){ sprintf (outFile, "%d report_uncertainty %s\n", _cpt,(const char *)s); fflush(outFile); return waitResponse();}/* Function: List the stones of a worm* Arguments: the location* Fails: if called on an empty or off-board location* Returns: list of stones*/intQGtp::wormStones(){ sprintf (outFile, "%d worm_stones\n", _cpt); fflush(outFile); return waitResponse();}intQGtp::shell(QString s){ sprintf (outFile, "%d %s\n", _cpt, (const char *)s); fflush(outFile); return waitResponse();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -