From 26fd5b1d5b7243ee1d33371fe760153d88e925b9 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 1 Oct 2021 16:57:39 +0200 Subject: [PATCH] Update get_next_player_to_play() --- src/model.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/model.c b/src/model.c index f0020bd..afd9554 100644 --- a/src/model.c +++ b/src/model.c @@ -107,11 +107,12 @@ void free_utictactoe(s_utictactoe *p_uttt){ } e_player get_next_player_to_play(s_utictactoe *p_uttt) { + if ( p_uttt->outer_tictactoe->winner != NOBODY ) { return NOBODY; - } + } - if ( p_uttt->history->last_move->player == PLAYER_O || + if ( (p_uttt->history->last_move && p_uttt->history->last_move->player == PLAYER_O) || p_uttt->history->last_move == NULL ) { return PLAYER_X; }