More standard
This commit is contained in:
parent
acf8648b64
commit
ec5dc1c467
13
src/main.cpp
13
src/main.cpp
@ -10,16 +10,16 @@
|
|||||||
|
|
||||||
#define TILE_COUNT 9
|
#define TILE_COUNT 9
|
||||||
|
|
||||||
int get_player_input(){
|
|
||||||
//TODO get player input
|
|
||||||
return rand()%9;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct game_state {
|
struct game_state {
|
||||||
int turn;
|
int turn;
|
||||||
char board[TILE_COUNT];
|
char board[TILE_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int get_player_input(){
|
||||||
|
//TODO get player input
|
||||||
|
return rand()%9;
|
||||||
|
}
|
||||||
|
|
||||||
int check_win_condition(const game_state& gs, char player){
|
int check_win_condition(const game_state& gs, char player){
|
||||||
int i;
|
int i;
|
||||||
for( i = 0 ; i < 3 ; i++){
|
for( i = 0 ; i < 3 ; i++){
|
||||||
@ -51,8 +51,7 @@ void display_game_state(const game_state& gs){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void player_turn(game_state& gs, char player, int input)
|
void player_turn(game_state& gs, char player, int input){
|
||||||
{
|
|
||||||
if(input > TILE_COUNT && input < 0)
|
if(input > TILE_COUNT && input < 0)
|
||||||
fprintf(stderr,"ERR: player input not in range.");
|
fprintf(stderr,"ERR: player input not in range.");
|
||||||
if(!gs.board[input])
|
if(!gs.board[input])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user