-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
37 lines (29 loc) · 645 Bytes
/
Copy pathmain.c
File metadata and controls
37 lines (29 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// terminal-chess.cpp : Defines the entry point for the application.
//
#include "stdio.h"
#include "game.h"
#include "locale.h"
#include "io.h"
#ifdef _WIN32
#include "windows.h"
#include <WinNls.h>
#endif
int main()
{
setlocale(LC_ALL, "en_US.UTF-8");
#ifdef _WIN32
SetConsoleOutputCP(CP_UTF8);
#endif
Game* game = game_create();
// board_print(game);
while (!game_is_over(game)) {
clear_screen();
board_print(game);
printf("\nPlayer to move: %s\n", game->current_player == WHITE ? "white" : "black");
board_move(game, get_move(game));
}
clear_screen();
board_print(game);
game_print_winner(game);
return 0;
}