From 399d90f1b94717aa0ca5abb1dc43bdb6f4160d13 Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sun, 31 Jan 2021 15:33:30 -0500 Subject: Fairly important bug fixes to lcdlib, LCD now echoes input! Input polling without line-buffering is done using ncurses, so the buildroot configuration had to change accordingly to include that library. The Makefile changed to accommodate stand-alone building of ct1986 and to include -lcurses where appropriate. There were also some typos about copying ct1986 and ctaklm to the correct directories. --- src/ctaklm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/ctaklm.c') diff --git a/src/ctaklm.c b/src/ctaklm.c index 681f29c..4d910c4 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -171,13 +171,16 @@ print_info(void) { } static int human; -static char *gamelog = 0; +static char *gamelog = NULL; static uint8_t auto_board = 0xFF, auto_info = 0xFF; -static void +static int append_to_gamelog(const char *line, const uint8_t win_line) { // I _could_ dynamically compute the size but ... don't let // `perfect' be the enemy of `good' ? + + if (gamelog == NULL) return EXIT_FAILURE; + char prepend[8]; if (win_line) { @@ -194,8 +197,11 @@ append_to_gamelog(const char *line, const uint8_t win_line) { strlen(gamelog) + strlen(prepend) + strlen(line) + 1); - strcat(gamelog,prepend); - strcat(gamelog,line); + // TODO: trap errno + strcat(gamelog, prepend); + strcat(gamelog, line); + + return EXIT_SUCCESS; } static void @@ -438,13 +444,12 @@ int main(int argc, char **argv) { puts(license); - negamax_search_depth = 3; + negamax_search_depth = 5; new_game(5); negamax_init(5); // Test harness if (argc > 1) { - negamax_search_depth = 5; load_ptn("data/0.ptn"); negamax_turn(); return 0; -- cgit v1.3.1