From 6b84aaedc66c740b8356f541273253483e2cc55a Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Thu, 18 Jun 2020 01:03:36 +0200 Subject: [PATCH] Implement benchmark, correct name for ACF_CLEAR_UNMOVE --- ArduChess.ino | 58 ++++++++++++++++++++++++++++++--------------------- Config.h | 4 ++-- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/ArduChess.ino b/ArduChess.ino index 6f12654..b8ed633 100644 --- a/ArduChess.ino +++ b/ArduChess.ino @@ -11,47 +11,57 @@ Board b = Board(); +void bench() { + b = Board(); + int startTime = micros(); + + b.make({0x14, 0x34, P_EMPTY}); + b.make({0x64, 0x54, P_EMPTY}); + b.make({0x34, 0x44, P_EMPTY}); + b.make({0x63, 0x43, P_EMPTY}); + b.make({0x44, 0x53, P_EMPTY}); + b.unmake(); + b.unmake(); + b.unmake(); + b.unmake(); + b.unmake(); + + int elapsed = micros() - startTime; + Serial.print(elapsed); + Serial.println(F("microseconds for 5 moves")); +} + + void setup() { // put your setup code here, to run once: Serial.begin(115200); - - //char value; - //while(Serial.available() == 0) { - // delay(100); - //} - //value = Serial.read(); - - //b.field[0x31] = char_to_piece(value); - - //Serial.println(F("hello")); - //delay(1000); - //Serial.println(b.get_zobrist()); - //Serial.println(sizeof(b)); - - //Move m = {0x14, 0x34, P_EMPTY}; - //Serial.println(F("Initial board")); - //b.print(); - //b.make(m); - //Serial.println(F("Board after e2e4")); - //b.print(); - //b.unmake(); - //Serial.println(F("Board after unmake")); - //b.print(); - //delay(1000); + bench(); Serial.println(F("hello")); b = Board(); int startTime = micros(); + b.print(); b.make({0x14, 0x34, P_EMPTY}); + b.print(); b.make({0x64, 0x54, P_EMPTY}); + b.print(); b.make({0x34, 0x44, P_EMPTY}); + b.print(); b.make({0x63, 0x43, P_EMPTY}); b.print(); b.make({0x44, 0x53, P_EMPTY}); b.print(); b.unmake(); b.print(); + b.unmake(); + b.print(); + b.unmake(); + b.print(); + b.unmake(); + b.print(); + b.unmake(); + b.print(); int elapsed = micros() - startTime; Serial.print(elapsed); diff --git a/Config.h b/Config.h index 702c10f..1a8b2a5 100644 --- a/Config.h +++ b/Config.h @@ -1,3 +1,3 @@ -// CLEAR_UNMAKE is a feature that clears the unmake stack when it is not used. +// CLEAR_UNMOVE is a feature that clears the unmake stack when it is not used. // This is useful for making it more human readable -//#define _ACF_CLEAR_UNMAKE +//#define _ACF_CLEAR_UNMOVE