-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli_engine.c
37 lines (32 loc) · 895 Bytes
/
cli_engine.c
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
#include "engines.h"
#include "game.h"
#include "console.h"
#include "player_interaction.h"
#include "config.h"
void run_cli_engine()
{
struct game_t game;
int nplayers, ncards;
char names[MAX_NUM_PLAYERS][MAX_NAME_LEN];
char types[MAX_NUM_PLAYERS];
char shithead[MAX_NAME_LEN];
clearscreen();
show_welcome_msg();
nplayers = request_num_players();
ncards = request_num_cards_each();
request_player_details(names, types, nplayers);
game = make_game(nplayers, names, types, ncards);
init_game(&game);
perform_swap(&game);
first_move(&game);
while (continue_play(&game)) {
clearscreen();
show_game_summary(&game);
if (player_on_last_cards(&game))
perform_last_cards_move(&game);
else
perform_move(&game);
}
get_shithead(&game, shithead);
show_shithead(shithead);
}