From 8074c408106dc40787ec946e2643011320a19dd9 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 1 Oct 2021 17:16:30 +0200 Subject: [PATCH] Test for get_next_player_to_play() --- src/model.c | 4 ++-- src/utictactoe.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/model.c b/src/model.c index 33773f6..0efadec 100644 --- a/src/model.c +++ b/src/model.c @@ -110,9 +110,9 @@ 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 == NULL ) { + if ( p_uttt->history == NULL ) { return PLAYER_X; } else { diff --git a/src/utictactoe.c b/src/utictactoe.c index b23d427..da95faa 100644 --- a/src/utictactoe.c +++ b/src/utictactoe.c @@ -147,6 +147,7 @@ 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);