aboutsummaryrefslogtreecommitdiff
path: root/src/ctlm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctlm.c')
-rw-r--r--src/ctlm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/ctlm.c b/src/ctlm.c
index 09900e3..13d5a97 100644
--- a/src/ctlm.c
+++ b/src/ctlm.c
@@ -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,