diff options
| -rw-r--r-- | src/ctlm.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -221,12 +221,17 @@ handle_turn(char *line) { uint8_t new_win = (won == 0xFF); switch (do_ptn(line)) { // Errors - case ACT_INVALID_PTN: { puts("Invalid PTN."); return -1; break; } - case ACT_ILLEGAL: { puts("Illegal action."); return -1; break; } + case ACT_INVALID_PTN: { + puts("Invalid PTN."); + return EXIT_FAILURE; + } + case ACT_ILLEGAL: { + puts("Illegal action."); + return EXIT_FAILURE; + } case ACT_OVERFLOW: { puts("Move would cause internal overflow, select another."); return EXIT_FAILURE; - break; } // Game has ended case GAME_END: { @@ -252,7 +257,6 @@ handle_turn(char *line) { break; } } - return EXIT_SUCCESS; } @@ -333,7 +337,7 @@ negamax_display_progress(const uint8_t cur_depth, progress = 0; } progress++; - printf("\x1B[0GComputing: %.0f/%d @ D%d ", + printf("\x1B[0G\x1B[KComputing: %.0f/%d @ D%d", progress, length, init_depth); fflush(stdout); } @@ -346,7 +350,7 @@ negamax_turn(void) { num_check = 0; progress = 0; old_depth = 0; float minimax = negamax_generate(); putchar('\n'); - // Failed to find a move? + // Failed to find a non-losing move? if (minimax <= -infty) puts("Opponent concedes!"); printf("Result: %s (%.2f, checked %.1e)\n", negamax_ptn, |
