diff --git a/FENTESTS.txt b/FENTESTS.txt index 796702a..4942414 100644 --- a/FENTESTS.txt +++ b/FENTESTS.txt @@ -26,6 +26,9 @@ k7/8/8/1p1p2pP/pPpPp3/P1PpPp2/NBNP1P2/KBB1B3 w - g6 0 1 # 2 Kings, W/B/ pawns on 7th for promotion k4n2/4P3/8/8/8/8/4p3/K4N2 w - - 0 1 +# position after 1.e4 +rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1 + # white castled, and can e.p. on c6 black can castle # white is a pawn down # white has 35 or 36 moves: P=11 + 1 e.p. N=6+3 B=5+5 R=1 Q=3 K=1 + 1 e.p. diff --git a/src/chessdefs.h b/src/chessdefs.h index 9b60a83..084ee82 100644 --- a/src/chessdefs.h +++ b/src/chessdefs.h @@ -80,6 +80,12 @@ enum { #define SET_BLACK(p) ((p) |= MASK_COLOR) #define SET_COLOR(p, c) (!(c)? SET_WHITE(p): SET_BLACK(p)) +/* flip a 0-63 square: + * Vertical: G8 (62) becomes G1 (6) + * Horizontal: G8 (62) becomes B8 (57) + */ +#define FLIP_V(sq) ((sq) ^ 56) +#define FLIP_H(sq) ((sq) ^ 7) /* square_t bits structure : rrrrffff * ffff: file * rrrr: rank @@ -98,6 +104,12 @@ typedef unsigned char castle_t; #define CASTLE_W (CASTLE_WK | CASTLE_WQ) /* 00000011 W castle mask */ #define CASTLE_B (CASTLE_BK | CASTLE_BQ) /* 00001100 B castle mask */ +/* game phases + */ +#define OPENING 0 +#define MIDDLEGAME 1 +#define ENDGAME 2 + /* bitboard */ typedef u64 bitboard_t;