Implement benchmark, correct name for ACF_CLEAR_UNMOVE

This commit is contained in:
Quinten Kock 2020-06-18 01:03:36 +02:00
parent c69d0b96d5
commit 6b84aaedc6
2 changed files with 36 additions and 26 deletions

View File

@ -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);

View File

@ -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