Start implementing make

This commit is contained in:
Quinten Kock 2020-06-16 00:10:21 +02:00
parent 7c05006d9d
commit 9adccec70a
2 changed files with 27 additions and 11 deletions

View File

@ -17,6 +17,9 @@ void setup() {
value = Serial.read();
b.field[0x32] = char_to_piece(value);
Move m = {0x14, 0x34, P_EMPTY};
b.make(m);
}
void loop() {
@ -26,4 +29,6 @@ void loop() {
Serial.println(b.get_zobrist());
b.print();
Serial.println(sizeof(b));
Move m = {0x14, 0x34, P_EMPTY};
b.make(m);
}

33
Board.h
View File

@ -2,27 +2,23 @@
#define __BOARD_H_INC
#include "Types.h"
#include "Panic.h"
#include "Move.h"
struct Unmake {
struct Unmove {
byte sq_from;
byte sq_to;
byte enpassant;
};
class Board {
public:
Board();
void print() {
for(char i = 7; i >= 0; i--) {
for(byte j = 0; j < 16; j++) {
Serial.print(field[i*16 + j], HEX);
Serial.print(" ");
}
Serial.println();
}
}
void make(Move m);
void unmove();
void print();
unsigned long get_zobrist() {
long* addr = (long*) &field[PTR_ZOBRIST];
@ -102,5 +98,20 @@ Board::Board() {
field[PTR_ZOBRIST+1] = 1;
}
void Board::print() {
for(char i = 7; i >= 0; i--) {
for(byte j = 0; j < 16; j++) {
Serial.print(field[i*16 + j], HEX);
Serial.print(" ");
}
Serial.println();
}
}
void Board::make(Move m) {
Unmove u = Unmove {0xAA, 0xBB, 0xCC};
store_unmove(u);
Unmove u2 = read_unmove();
Serial.println(u2.sq_to, HEX);
}
#endif