aboutsummaryrefslogtreecommitdiff
path: root/src/ctaklm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctaklm.c')
-rw-r--r--src/ctaklm.c17
1 files changed, 11 insertions, 6 deletions
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;