diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-25 23:48:42 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | 9c151da7ce0d00ecf04e4be9c395604d4c8882ad (patch) | |
| tree | cb306bff965d517ca9b7c068040ed883bedf375c | |
| parent | fa382246017019bd2f0f3a303241bd2990c3cbdd (diff) | |
Stripping debug stuff
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | include/negamax.c | 32 | ||||
| -rw-r--r-- | src/ctaklm.c | 23 |
3 files changed, 3 insertions, 54 deletions
@@ -1,6 +1,6 @@ IDIR=include DEFINES=-DDETERMINISTIC -CFLAGS=-g -Wall -Wextra -Wpedantic -std=c99 -D_DEFAULT_SOURCE $(DEFINES) -I$(IDIR) -lm +CFLAGS=-O3 -Wall -Wextra -Wpedantic -std=c99 -D_DEFAULT_SOURCE $(DEFINES) -I$(IDIR) -lm LIBS= SRCS=$(wildcard include/*.c) diff --git a/include/negamax.c b/include/negamax.c index abb4e27..912705d 100644 --- a/include/negamax.c +++ b/include/negamax.c @@ -115,16 +115,11 @@ negamax(const uint8_t cur_depth, float alpha, float beta, const float colour) { float value = -infty; - - data_t bd[5*5]; - colour_stack_t bc[25]; - action_list_t *list = action_list_generate(); if (list == NULL) return value; // ??? for (action_node_t *node=list->head; node!=NULL; node=node->next) { - for (int k=0; k<25; k++) { bd[k]=celldat[k]; bc[k]=colours[k]; } action_take(node); // Compute the value of the node @@ -143,31 +138,6 @@ negamax(const uint8_t cur_depth, float alpha, float beta, } action_undo(node); - for (int k=0; k<25; k++) { - if (bd[k]!=celldat[k]) { - printf("Depth %d %.3f %.3f %d: { .type = %s, .loc = 0x%02X, .data0 = 0x%02X, .data1 = 0x%02X} DIFF 0x%02X \n", - cur_depth, - alpha, - beta, - ply, - (node->type == A_PLACE) ? "A_PLACE" : "A_MOVE", - node->loc, - node->data0, - node->data1, - k); - puts("Before:"); - for (int j=0; j<25;j++) printf("0x%02X ",bd[j]); - putchar('\n'); - for (int j=0; j<25;j++) printf("0x%02X ",bc[j]); - putchar('\n'); - puts("After:"); - for (int j=0; j<25;j++) printf("0x%02X ",celldat[j]); - putchar('\n'); - for (int j=0; j<25;j++) printf("0x%02X ",colours[j]); - putchar('\n'); - exit(1); - } - } negamax_display_progress(cur_depth, list->length); @@ -178,7 +148,7 @@ negamax(const uint8_t cur_depth, float alpha, float beta, if (alpha >= beta) break; } } - prune: + action_list_free(list); return value; } diff --git a/src/ctaklm.c b/src/ctaklm.c index c395c29..dda6eb1 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -416,32 +416,11 @@ main(int argc, char **argv) { (void)(argc); (void)(argv); - negamax_search_depth = 2; + negamax_search_depth = 5; new_game(5); negamax_init(5); tt_init(); - auto_board = 1; - auto_info = 0; - negamax_search_depth = 4; - for (int k=0; k<10; k++) negamax_turn(); - return 0; - - ply = 7; current_colour=C_BLACK; - celldat[0x00]=0x22; colours[0x00]=0x05; - celldat[0x01]=0x10; colours[0x01]=0x00; - celldat[0x02]=0x11; colours[0x02]=0x00; - print_board(); - - action_list_t *list = action_list_generate(); - - - action_node_t a = {.next = NULL, .type = A_MOVE, .loc = 0x0, .data0 = 0x80, .data1 = 0x31}; - action_take(&a); print_board(); - action_undo(&a); print_board(); - return 0; - - // Test harness if (argc > 1) { negamax_search_depth = 5; |
