summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-08-31 05:18:34 +0300
committereug-vs <eugene@eug-vs.xyz>2022-08-31 05:18:34 +0300
commit64a1d2a38bdb6c0b7361af05f955ea55eafffbb3 (patch)
treef28b0609848ed9b247fe66cf716a2ee4da1491e6
parentddb282a899fc61a124328cc79511a20cca60f655 (diff)
downloadc-chess-64a1d2a38bdb6c0b7361af05f955ea55eafffbb3.tar.gz
feat: cosmetic changes
-rw-r--r--src/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 372c01e..b78d207 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,6 +52,7 @@ long apply_move_zobrist(Move move, int* board, long* zobrist_seed, long hash) {
void print_board(int board[128]) {
+ printf("\n");
for (int rank = 7; rank >= 0; rank--) {
printf("%i|", rank + 1);
for (int file = 0; file < 8; file++) {
@@ -547,13 +548,12 @@ Move find_best_move(int* board, int color, int depth, int alpha, int beta, int*
}
int main() {
- int color = WHITE;
int board[128];
parse_FEN(DEFAULT_FEN, board);
long zobrist_seed[MAX_ZOBRIST_SEEDS];
generate_zobrist_seed(zobrist_seed);
- long hash = zobrist_hash(zobrist_seed, board, color);
+ long hash = zobrist_hash(zobrist_seed, board, WHITE);
int transposition_table[TRANSPOSITION_TABLE_SIZE];
@@ -561,7 +561,11 @@ int main() {
print_board(board);
+ int ply = 0;
while (1) {
+ int color = ply % 2;
+ printf("##### Ply %i #####\n", ply);
+ printf("Current score: %i\n", compute_score(board, 0, WHITE));
printf("Zobrist hash: %lo\n", hash);
if (color == PLAYER) {
@@ -579,7 +583,7 @@ int main() {
char move_in_notation[] = "xy XY";
index_to_notation(move.origin, move_in_notation);
index_to_notation(move.destination, move_in_notation + 3);
- printf("%s: %s with score %i in #%i moves\n", COLORS[color], move_in_notation, move.value, MAX_DEPTH);
+ printf("%s: %s with score at worst %i on Ply %i\n", COLORS[color], move_in_notation, move.value, ply + MAX_DEPTH);
}
int error = validate_move(move, color, board);
@@ -593,9 +597,8 @@ int main() {
apply_move(move, board);
print_board(board);
- printf("Current score: %i\n", compute_score(board, 0, WHITE));
- color ^= 1;
+ ply++;
}
}