attempts are being made

This commit is contained in:
Quinten Kock 2020-06-19 17:58:18 +02:00
parent db63b54764
commit ec306fe6ad
2 changed files with 8 additions and 7 deletions

View File

@ -177,8 +177,8 @@ void setup() {
board_init(); board_init();
Serial.begin(115200); Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
perft_test(); //perft_test();
bench(); //bench();
} }
void loop() { void loop() {

11
Uci.h
View File

@ -5,7 +5,7 @@ typedef void uci_return;
typedef uci_return (*uci_handler)(); typedef uci_return (*uci_handler)();
struct uci_cmd { struct uci_cmd {
char* command; const char* command;
uci_handler handler; uci_handler handler;
}; };
@ -36,13 +36,14 @@ const uci_cmd UCI_COMMANDS[] = {
const uci_cmd UCI_INVALID = {"", &uci_unknown}; 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); size_t command_num = sizeof(UCI_COMMANDS) / sizeof(uci_cmd);
for(int i = 0; i < command_num; i++) { for(size_t i = 0; i < command_num; i++) {
int ci = 0; size_t ci = 0;
uci_cmd to_try = UCI_COMMANDS[i]; uci_cmd to_try = UCI_COMMANDS[i];
while(true) { while(true) {
if(to_try.command[ci] != command[ci]) { char reference = to_try.command[ci];
if(reference != command[ci]) {
break; break;
} }
if(command[ci] == '\0') { if(command[ci] == '\0') {