From 2fb71fcbc594c3a3f32ee0c95be2e4e9b9ae97df Mon Sep 17 00:00:00 2001 From: tslil Date: Tue, 12 Jan 2021 00:10:12 -0500 Subject: This finally works! --- include/ct1973.c | 701 ++----------------------------------------------------- 1 file changed, 16 insertions(+), 685 deletions(-) (limited to 'include/ct1973.c') diff --git a/include/ct1973.c b/include/ct1973.c index 78be1f5..592b0b1 100644 --- a/include/ct1973.c +++ b/include/ct1973.c @@ -13,17 +13,18 @@ evaluate_black_win(void) { * Convolution layer * * ------------------ */ // for each kernel - for (uint8_t k = 0; k < KERN_NUM; k++) { + for (uint8_t kern = 0; kern < KERN_NUM; kern++) { // the stride is 1, march across the board - for (uint8_t by = 0; by < KERN_OSIZE; by++) { - for (uint8_t bx = 0; bx < KERN_OSIZE; bx++) { - flattened[k+KERN_NUM*(by+bx*KERN_OSIZE)] = 0; // conv2d_biases[k]; + for (uint8_t bx = 0; bx < KERN_OSIZE; bx++) { + for (uint8_t by = 0; by < KERN_OSIZE; by++) { + flattened[kern+KERN_NUM*(bx+by*KERN_OSIZE)] = + conv2d_biases[kern]; // Compute the convolution for this position for (uint8_t ky = 0; ky < KERN_SIZE; ky++) { for (uint8_t kx = 0; kx < KERN_SIZE; kx++) { for (uint8_t c = 0; c < KERN_CHAN; c++) { // Where we are on the board - const uint8_t loc = kx+bx+(ky+by)*board_size; + const uint8_t loc = kx+by+(ky+bx)*board_size; // Look up what's on the board at this location, and // multiply it. For c=0 we have to do some extra work float lookup = 0; @@ -37,30 +38,28 @@ evaluate_black_win(void) { lookup = (colours[loc] & 1) ? +0.50 : -0.50; } } else { - lookup = (colours[k] & (1<