From 5507db23dda74aba72d8f0ab6e392a5eb5b141c3 Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Sat, 20 Jun 2020 03:38:03 +0200 Subject: [PATCH] Remove Move.h (moved to Types.h) --- ArduChess.ino | 3 --- Board.h | 2 -- Move.h | 15 --------------- Movegen.h | 1 - Tasks.h | 5 ++++- Types.h | 10 ++++++++++ Uci.h | 7 +++++++ 7 files changed, 21 insertions(+), 22 deletions(-) delete mode 100644 Move.h diff --git a/ArduChess.ino b/ArduChess.ino index 876650e..335e21e 100644 --- a/ArduChess.ino +++ b/ArduChess.ino @@ -5,9 +5,6 @@ #include "Config.h" #include "Board.h" -#include "Move.h" -#include "Movegen.h" -#include "Types.h" #include "Uci.h" void setup() { diff --git a/Board.h b/Board.h index 4adb532..ab4fca2 100644 --- a/Board.h +++ b/Board.h @@ -3,7 +3,6 @@ #include "Types.h" #include "Panic.h" -#include "Move.h" namespace Board { @@ -289,7 +288,6 @@ namespace Board { field[PTR_SIDE_AND_CASTLERIGHT] ^= 0x01; field[PTR_ENPASSANT] = u.captured >> 4; } - } diff --git a/Move.h b/Move.h deleted file mode 100644 index 3ce5083..0000000 --- a/Move.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __MOVE_H_INC -#define __MOVE_H_INC - -#include "Types.h" - -struct Move { - byte sq_from; // 0x88 - byte sq_to; // 0x88 - Piece pc_prom; // 0b(4unused)(1color)(3type) -}; - -//Move move_from_str(char* s) { -//} - -#endif diff --git a/Movegen.h b/Movegen.h index db7a97f..e6290f2 100644 --- a/Movegen.h +++ b/Movegen.h @@ -2,7 +2,6 @@ #define __MOVEGEN_H_INC #include "Types.h" -#include "Move.h" const static byte SLIDE_OFFSETS[] = {255, 1, 240, 16, 15, 17, 241, 239}; const static byte KNIGHT_OFFSETS[] = {225, 31, 223, 33, 238, 18, 242, 14}; diff --git a/Tasks.h b/Tasks.h index c33f886..4ba660e 100644 --- a/Tasks.h +++ b/Tasks.h @@ -1,6 +1,9 @@ #ifndef __TASKS_H_INC #define __TASKS_H_INC +#include "Types.h" +#include "Movegen.h" + unsigned long pseudo_perft(byte depth) { // only checks pseudolegality // but, it should work overall @@ -100,7 +103,7 @@ void debug_ep() { void bench() { // TODO reduce code size of this (by moving repeated constants from here to PROGMEM and loops?) - + unsigned long startTime = micros(); Board::make({0x14, 0x34, P_EMPTY}); diff --git a/Types.h b/Types.h index 3b12c24..ed4848c 100644 --- a/Types.h +++ b/Types.h @@ -40,4 +40,14 @@ char piece_to_char(Piece p) { return CHAR_STRS[p]; } + +struct Move { + byte sq_from; // 0x88 + byte sq_to; // 0x88 + Piece pc_prom; // 0b(4unused)(1color)(3type) +}; + +//Move move_from_str(char* s) { +//} + #endif diff --git a/Uci.h b/Uci.h index 5aef0f2..01deb5c 100644 --- a/Uci.h +++ b/Uci.h @@ -37,11 +37,18 @@ namespace Uci { uci_return uci_perft() { int depth = Serial.parseInt(); + + unsigned long startTime = millis(); unsigned long result = pseudo_perft(depth); + unsigned long elapsed = millis() - startTime; + Serial.print(F("perft(")); Serial.print(depth); Serial.print(F(") result: ")); Serial.println(result); + Serial.print(F("Completed in ")); + Serial.print(elapsed); + Serial.println(F("ms")); } const char UCI_COMMAND_uci[] PROGMEM = "uci";