v2 initial commit
This commit is contained in:
+2
-50
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user