From 2dbb9fa9b69e49d49cebb1c17559f6fe67600a4d Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sun, 28 Mar 2021 00:19:05 -0400 Subject: Fix copyright notice in files, and small preemptive optimisation Eventually there'll be a more complicated data generation step than the one we're presently using, so having it in-lined in the loop is wasteful. Ideally also this would be update per ply and we could avoid recalculating it entirely for every query -- though it's probably ``fast enough'' for now. Also, caching is WIP. --- include/actions.c | 2 +- include/actions.h | 2 +- include/cnn1986.c | 50 ++++++++++++++++++++++++++++++-------------------- include/cnn1986.h | 2 +- include/lcdlib.c | 2 +- include/lcdlib.h | 2 +- include/negamax.c | 2 +- include/negamax.h | 2 +- include/tak.c | 2 +- include/tak.h | 2 +- include/tt_llcht.c | 2 +- include/tt_llcht.h | 2 +- include/weights.c | 2 +- include/weights.h | 2 +- include/xorshift64.c | 2 +- include/xorshift64.h | 2 +- include/zobrist.c | 2 +- include/zobrist.h | 2 +- 18 files changed, 47 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/include/actions.c b/include/actions.c index 0b7d860..374f4f9 100644 --- a/include/actions.c +++ b/include/actions.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "actions.h" diff --git a/include/actions.h b/include/actions.h index 37c8d9e..75c881e 100644 --- a/include/actions.h +++ b/include/actions.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #ifndef ACTIONS_H diff --git a/include/cnn1986.c b/include/cnn1986.c index dc0e116..9191ec8 100644 --- a/include/cnn1986.c +++ b/include/cnn1986.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "cnn1986.h" @@ -27,8 +27,34 @@ static float dense1[DENSE1_NUM]; static float dense2[DENSE2_NUM]; #define RELU(x) ((x) = ((x)<0)?0:(x)) - float cnn1986_evaluate_black_win(void) { + /* --------------- * + * Generate input * + * --------------- */ + + float cur_board[board_size*board_size][KERN_CHAN]; + for (int y = 0; y < board_size; y++) { + for (int x = 0; x < board_size; x++) { + const int loc = x+y*board_size; + for (int c = 0; c < KERN_CHAN; c++) { // heh, c++ + float lookup = 0; + if (COUNT_AT(loc)>c) { + if (c==0) { + if (STONE_AT(loc) == STONE_STANDING) { + lookup = (colours[loc] & 1) ? +0.25 : -0.25; + } else if (STONE_AT(loc) == STONE_CAPSTONE) { + lookup = (colours[loc] & 1) ? +1.00 : -1.00; + } else { + lookup = (colours[loc] & 1) ? +0.50 : -0.50; + } + } else { + lookup = (colours[loc] & (1<c) { - if (c==0) { - if (STONE_AT(loc) == STONE_STANDING) { - lookup = (colours[loc] & 1) ? +0.25 : -0.25; - } else if (STONE_AT(loc) == STONE_CAPSTONE) { - lookup = (colours[loc] & 1) ? +1.00 : -1.00; - } else { - lookup = (colours[loc] & 1) ? +0.50 : -0.50; - } - } else { - lookup = (colours[loc] & (1<. + along with ct. If not, see . */ #include diff --git a/include/lcdlib.c b/include/lcdlib.c index efbdf3d..4d8c33e 100644 --- a/include/lcdlib.c +++ b/include/lcdlib.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "lcdlib.h" diff --git a/include/lcdlib.h b/include/lcdlib.h index 7750c7b..87aef12 100644 --- a/include/lcdlib.h +++ b/include/lcdlib.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include diff --git a/include/negamax.c b/include/negamax.c index 0afa153..a970b83 100644 --- a/include/negamax.c +++ b/include/negamax.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "negamax.h" diff --git a/include/negamax.h b/include/negamax.h index 4a09ecb..f56f405 100644 --- a/include/negamax.h +++ b/include/negamax.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include diff --git a/include/tak.c b/include/tak.c index b93660f..78d3854 100644 --- a/include/tak.c +++ b/include/tak.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "tak.h" diff --git a/include/tak.h b/include/tak.h index 1c73002..8a1d8be 100644 --- a/include/tak.h +++ b/include/tak.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #ifndef TAK_H diff --git a/include/tt_llcht.c b/include/tt_llcht.c index 1ea8767..60f8ccc 100644 --- a/include/tt_llcht.c +++ b/include/tt_llcht.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "tt_llcht.h" diff --git a/include/tt_llcht.h b/include/tt_llcht.h index c23f814..377de10 100644 --- a/include/tt_llcht.h +++ b/include/tt_llcht.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #ifndef TT_LLCHT_H diff --git a/include/weights.c b/include/weights.c index ec28401..1aba298 100644 --- a/include/weights.c +++ b/include/weights.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "weights.h" diff --git a/include/weights.h b/include/weights.h index f736198..eff0a68 100644 --- a/include/weights.h +++ b/include/weights.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #define KERN_SIZE 3 diff --git a/include/xorshift64.c b/include/xorshift64.c index b743d68..6fd8577 100644 --- a/include/xorshift64.c +++ b/include/xorshift64.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "xorshift64.h" diff --git a/include/xorshift64.h b/include/xorshift64.h index 0b48f39..54392a0 100644 --- a/include/xorshift64.h +++ b/include/xorshift64.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #ifndef XORSHIFT_H diff --git a/include/zobrist.c b/include/zobrist.c index bedfa68..48a115b 100644 --- a/include/zobrist.c +++ b/include/zobrist.c @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include "zobrist.h" diff --git a/include/zobrist.h b/include/zobrist.h index 8bf19cb..be657fc 100644 --- a/include/zobrist.h +++ b/include/zobrist.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . + along with ct. If not, see . */ #include -- cgit v1.3.1