Update get_next_player()

This commit is contained in:
Yorick Barbanneau 2021-10-01 16:40:30 +02:00
parent 48c6360b0d
commit c342b2c416

View file

@ -107,7 +107,11 @@ void free_utictactoe(s_utictactoe *p_uttt){
} }
e_player get_next_player_to_play(s_utictactoe *p_uttt) { e_player get_next_player_to_play(s_utictactoe *p_uttt) {
if ( p_uttt->history->last_move->player == PLAYER_O ) { if ( p_uttt->outer_tictactoe->winner != NOBODY ) {
return NOBODY;
}
if ( p_uttt->history->last_move->player == PLAYER_O ||
p_uttt->history->last_move == NULL ) {
return PLAYER_X; return PLAYER_X;
} }
else { else {
@ -237,7 +241,7 @@ void set_tictactoe_winner(s_tictactoe *p_ttt){
} }
} }
} }
} }
} }
e_status play_move(s_utictactoe *p_uttt, s_move *p_move) { e_status play_move(s_utictactoe *p_uttt, s_move *p_move) {