diff options
Diffstat (limited to 'src/geminict.c')
| -rw-r--r-- | src/geminict.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/geminict.c b/src/geminict.c index 2e94e7d..48d4380 100644 --- a/src/geminict.c +++ b/src/geminict.c @@ -302,18 +302,22 @@ static enum TURN_RESULT negamax_turn(void) { } int main(int argc, char **argv) { - if (argc != 2) { - puts("Usage: PTN1.[PTN2.][PTN3.] etc"); + if (argc != 3) { + puts("Usage: <depth> PTN1.[PTN2.][PTN3.] etc"); return EXIT_FAILURE; }; - negamax_search_depth = 5; + negamax_search_depth = atoi(argv[1]); + if (negamax_search_depth == 0 || negamax_search_depth > 6) { + puts("Depth must be an integer in [1, 6]"); + return EXIT_FAILURE; + }; new_game(5); negamax_init(5); enum TURN_RESULT tr; - char *line = argv[1]; + char *line = argv[2]; // Some maximum length we're willing to parse uint32_t len = strnlen(line, 65535); if (!line || len < 2 || len == 65535) { @@ -365,7 +369,7 @@ int main(int argc, char **argv) { tr = negamax_turn(); if (tr == T_ERR) { - puts("This shouldn't happen, ct1986 encountered an error."); + puts("This shouldn't happen, geminict encountered an error."); print_everything(); return EXIT_FAILURE; } else if (tr == T_WIN) |
