diff options
| author | tslil clingman <tslil@posteo.de> | 2021-02-05 16:24:39 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | fb99bf2cf28fe236ef06c5df30d6b8cbfad9897e (patch) | |
| tree | d23ba2d56a11c0fdeae90361d08938f383ff99b6 | |
| parent | 5c475a552dbf16589d212bc7de7ed526b47aad08 (diff) | |
Correct line clearing behaviour, EXIT_FAILURE <~ -1
| -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, |
