aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-09-13 21:12:18 +0300
committereug-vs <eugene@eug-vs.xyz>2022-09-13 21:12:18 +0300
commit7a4d16e5ebd45b15b0c4925894c25a81c2e135c6 (patch)
tree6b26532d97128a6bd2df8c0c5976f7a74f8fd861 /src
downloadj1chess-7a4d16e5ebd45b15b0c4925894c25a81c2e135c6.tar.gz
chore: initialize project
Diffstat (limited to 'src')
-rw-r--r--src/board.h29
-rw-r--r--src/main.c7
-rw-r--r--src/types.h5
3 files changed, 41 insertions, 0 deletions
diff --git a/src/board.h b/src/board.h
new file mode 100644
index 0000000..6cde670
--- /dev/null
+++ b/src/board.h
@@ -0,0 +1,29 @@
+#include "types.h"
+
+#define WHITE 0b0000
+#define BLACK 0b0001
+
+#define PAWN 0b0000
+#define KNIGHT 0b0010
+#define BISHOP 0b0100
+#define ROOK 0b0110
+#define QUEEN 0b1000
+#define KING 0b1010
+
+typedef QWORD Bitboard;
+
+typedef struct {
+ Bitboard pieces[12];
+ BYTE side;
+ BYTE castling_rights;
+ BYTE en_passant_square;
+} Board;
+
+const char* pieces[] = {
+ "♟︎", "♙",
+ "♞", "♘",
+ "♝", "♗",
+ "♜", "♖",
+ "♛", "♕",
+ "♚", "♔",
+};
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..e9902b2
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include "board.h"
+
+int main() {
+ printf("Size of board: %lu bytes\n", sizeof(Board));
+ return 0;
+}
diff --git a/src/types.h b/src/types.h
new file mode 100644
index 0000000..4f95bb3
--- /dev/null
+++ b/src/types.h
@@ -0,0 +1,5 @@
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long QWORD;
+
+