From f319f0e53c8dd4d7fbefd9084b6cb5922d24326d Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 1 Oct 2021 17:20:15 +0200 Subject: [PATCH] Add missing test --- src/model.c | 3 +++ src/utictactoe.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model.c b/src/model.c index 0efadec..996a17a 100644 --- a/src/model.c +++ b/src/model.c @@ -115,6 +115,9 @@ e_player get_next_player_to_play(s_utictactoe *p_uttt) { if ( p_uttt->history == NULL ) { return PLAYER_X; } + else if( p_uttt->history->last_move->player == PLAYER_O){ + return PLAYER_X; + } else { return PLAYER_O; } diff --git a/src/utictactoe.c b/src/utictactoe.c index da95faa..b23d427 100644 --- a/src/utictactoe.c +++ b/src/utictactoe.c @@ -147,7 +147,6 @@ int main(int argc, char* argv[]) { s_utictactoe *test_uttt = create_empty_utictactoe(1); free_utictactoe(test_uttt); test_uttt = create_empty_utictactoe(2); - get_next_player_to_play(test_uttt); free_utictactoe(test_uttt); test_uttt = create_empty_utictactoe(3); free_utictactoe(test_uttt);