v2 initial commit

This commit is contained in:
Odweta
2026-02-19 12:47:42 +01:00
parent 71e1f16fac
commit 84bc6660a7
8 changed files with 2 additions and 730 deletions
+2 -50
View File
@@ -1,54 +1,6 @@
// a chess implementation in pure C :)
#include "chess.h"
#include "render.h"
#include <stdlib.h>
#include <stdio.h>
/**
* steps to victory:
* 1. init the board with the default config
* 2. game loop
* 2a. select the current player (if first round - white starts)
* 2b. wait for the movement of the current player
* 2c. once a move is registered, perform it IF POSSIBLE
* 2d. check for captures and/or promotions and/or mates (check, stale...)
* 2e. if there is an end condition that is met, end the game; announce
* the results
*/
int main() {
// variable defs
board_t board;
move_t move;
player_e player;
unsigned int round_count = 0;
end_condition_e end_condition;
captured_t captured = {.white_n = 0, .black_n = 0};
bool running = true;
// algo begin
init_board(board);
show_help();
while (running) {
round_count++;
select_player(&player, round_count);
show_board(board, player);
get_move(board, &move);
end_condition = perform_move(&board, player, &captured, move);
if (end_condition == CHECKMATE || end_condition == STALEMATE) {
running = false;
}
}
announce_results(end_condition, player);
return EXIT_SUCCESS;
printf("Hello, World!\n");
return 0;
}