Skip to content

Commit

Permalink
check gtp command parameters + correct bug of michi defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
db3108 committed Apr 4, 2017
1 parent e2d77d6 commit c778662
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 113 deletions.
7 changes: 5 additions & 2 deletions debug.c
Expand Up @@ -55,10 +55,10 @@ void print_marker(Position *pos, Mark *marker)
print_pos(&pos2, stdout, 0);
}

char* debug(Game *game)
char* debug(Game *game, char *command)
// Analyse the subcommands of the gtp debug command
{
char *command = strtok(NULL," \t\n"), *ret="";
char *ret="";
char *known_commands = "\nblocks_OK\nenv8\nfix_atari\ngen_playout\n"
"match_pat3\nmatch_pat\nplayout\nprint_mark\nsavepos\nsetpos\n"
"to_play";
Expand All @@ -69,6 +69,9 @@ char* debug(Game *game)
Point moves[BOARDSIZE];
Position *pos = game->pos;

if (command == NULL)
return "Error - Missing parameters";

if (strcmp(command, "setpos") == 0) {
char *str = strtok(NULL, " \t\n");
while (str != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion michi.h
Expand Up @@ -80,7 +80,7 @@ Score final_score(Game *game, Status block_status[MAX_BLOCKS],
Status point_status[BOARDSIZE]);
Point genmove (Game *game, TreeNode *tree, int *owner_map, int *score_count);
//-------------------------- Functions in debug.c -----------------------------
char* debug(Game *game);
char* debug(Game *game, char *command);
//-------------------------- Functions in michi.c -----------------------------
TreeNode* best_move(TreeNode *tree, TreeNode **except);
void collect_infos(TreeNode *tree, int n, TreeNode *best
Expand Down

0 comments on commit c778662

Please sign in to comment.