bpaul-chess

UCI chess engine to replace Omelette Chess Engine
Log | Files | Refs | README | LICENSE

commit f60960a68551a765be30b6012e6f8bf4965c3bab
parent a664a7d86033b4f3061dcb8ca74cd022e9c28c97
Author: benjamin paul <bpaul@bpaul.xyz>
Date:   Sun, 24 Oct 2021 19:33:51 +1000

i had to transfer files sorry

Diffstat:
Msrc/gen.c | 35+++++++++++++++++++++++++++++++++++
Msrc/pos.c | 2++
2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -3,6 +3,41 @@ #include "bb.h" #include "pos.h" +/* Todo for writing a move generator: + * + * Create a method for storing a move + * Get the attacks for the pieces + * Iterate through each piece and create each move based on their attacks + * For pawns, cry + * For castling, cry */ + +/* Move structure + * want a move to be relatively simple to store as we will be making a list of + * moves + * needed information: + * from square + * to square + * promotion piece + * helpful to have information: + * whether the move is en passant or castling + * maybe if it is castling what type of castling + * + * from is 6 bits + * to is 6 bits + * movetype is 2 bits + * promotion piece is 2 bits OR castling type is 2 bits! + * thats 16 bits total + * 00 promotion/castling bits + * 00 move type + * 000000 to square + * 000000 from square + */ + +unsigned short +storemove(char from, char to, char movetype, char extra) { + return from + (to << 6) + (movetype << 12) + (extra << 14); +} + void gen_pseudo(pos *p) { bb our_pieces[6]; diff --git a/src/pos.c b/src/pos.c @@ -161,6 +161,8 @@ print_board(pos *p) { int r,c; for (r = 7; r >= 0; r--) { for (c = 0; c <= 7; c++) { + /* This is a funky string index lookup thing where the piece at the + * current square is the index in the string */ putchar("pnbrqk PNBRQK."[p->mailbox[square(r,c)]]); } puts("");