Update p_uttt in play_move)
This commit is contained in:
parent
514e9f397f
commit
10d2bca697
1 changed files with 3 additions and 1 deletions
|
@ -270,7 +270,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) {
|
||||||
if (is_move_valid(p_uttt, p_move) == YES) {
|
if (is_move_valid(p_uttt, p_move) == YES) {
|
||||||
// we can process things
|
|
||||||
p_uttt->outer_tictactoe->content[p_move->outer_position] = p_move->player;
|
p_uttt->outer_tictactoe->content[p_move->outer_position] = p_move->player;
|
||||||
list_element_s_move *value = (list_element_s_move*)
|
list_element_s_move *value = (list_element_s_move*)
|
||||||
malloc(sizeof(list_element_s_move));
|
malloc(sizeof(list_element_s_move));
|
||||||
|
@ -287,8 +287,10 @@ e_status play_move(s_utictactoe *p_uttt, s_move *p_move) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
if ( p_uttt->inception_level == 1 ) {
|
if ( p_uttt->inception_level == 1 ) {
|
||||||
|
p_uttt->outer_tictactoe->content[p_move->outer_position] = p_move->player;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
p_uttt->inner_tictactoes[p_move->outer_position]->content[p_move->inner_position] = p_move->player;
|
||||||
set_tictactoe_winner(p_uttt->inner_tictactoes[p_move->inner_position]);
|
set_tictactoe_winner(p_uttt->inner_tictactoes[p_move->inner_position]);
|
||||||
}
|
}
|
||||||
set_tictactoe_winner(p_uttt->outer_tictactoe);
|
set_tictactoe_winner(p_uttt->outer_tictactoe);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue