From ec306fe6ad1e07d9af5b30d166ae06dd39a03963 Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Fri, 19 Jun 2020 17:58:18 +0200 Subject: [PATCH] attempts are being made --- ArduChess.ino | 4 ++-- Uci.h | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ArduChess.ino b/ArduChess.ino index 07fc84e..7e16aca 100644 --- a/ArduChess.ino +++ b/ArduChess.ino @@ -177,8 +177,8 @@ void setup() { board_init(); Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); - perft_test(); - bench(); + //perft_test(); + //bench(); } void loop() { diff --git a/Uci.h b/Uci.h index f940b99..4acc8e3 100644 --- a/Uci.h +++ b/Uci.h @@ -5,7 +5,7 @@ typedef void uci_return; typedef uci_return (*uci_handler)(); struct uci_cmd { - char* command; + const char* command; uci_handler handler; }; @@ -36,13 +36,14 @@ const uci_cmd UCI_COMMANDS[] = { const uci_cmd UCI_INVALID = {"", &uci_unknown}; -uci_cmd get_uci_command(char* command) { +uci_cmd get_uci_command(const char* command) { size_t command_num = sizeof(UCI_COMMANDS) / sizeof(uci_cmd); - for(int i = 0; i < command_num; i++) { - int ci = 0; + for(size_t i = 0; i < command_num; i++) { + size_t ci = 0; uci_cmd to_try = UCI_COMMANDS[i]; while(true) { - if(to_try.command[ci] != command[ci]) { + char reference = to_try.command[ci]; + if(reference != command[ci]) { break; } if(command[ci] == '\0') {