Browse Source

added validation 8/9

remotes/origin/ticTacToe
Aimee Reincke 2 years ago
parent
commit
4b3a0c31a5
  1. 16
      src/c/ticTacToe.c

16
src/c/ticTacToe.c

@ -436,24 +436,32 @@ void fillAlmostFull(char field[3][3], bool* pt) {
} }
if (field[2][1] == 'X') { if (field[2][1] == 'X') {
if (field[2][0] == 'X') { if (field[2][0] == 'X') {
if( field[2][2] == '-'){
field[2][2] = 'X'; field[2][2] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[2][2] == 'X') { else if (field[2][2] == 'X') {
if( field[2][0] == '-'){
field[2][0] = 'X'; field[2][0] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[1][1] == 'X') { else if (field[1][1] == 'X') {
if( field[0][1] == '-'){
field[0][1] = 'X'; field[0][1] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[0][1] == 'X') { else if (field[0][1] == 'X') {
if( field[1][1] == '-'){
field[1][1] = 'X'; field[1][1] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
} }
if (field[2][2] == 'X') { if (field[2][2] == 'X') {
@ -771,24 +779,32 @@ void fillAlmostFull(char field[3][3], bool* pt) {
} }
if (field[2][1] == 'O') { if (field[2][1] == 'O') {
if (field[2][0] == 'O') { if (field[2][0] == 'O') {
if( field[2][2] == '-'){
field[2][2] = 'X'; field[2][2] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[2][2] == 'O') { else if (field[2][2] == 'O') {
if( field[2][0] == '-'){
field[2][0] = 'X'; field[2][0] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[1][1] == 'O') { else if (field[1][1] == 'O') {
if( field[0][1] == '-'){
field[0][1] = 'X'; field[0][1] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[0][1] == 'O') { else if (field[0][1] == 'O') {
if( field[1][1] == '-'){
field[1][1] = 'X'; field[1][1] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
} }
if (field[2][2] == 'O') { if (field[2][2] == 'O') {

Loading…
Cancel
Save