Browse Source

added validation 3/9

remotes/origin/ticTacToe
Aimee Reincke 2 years ago
parent
commit
a61a03975e
  1. 24
      src/c/ticTacToe.c

24
src/c/ticTacToe.c

@ -230,34 +230,46 @@ void fillAlmostFull(char field[3][3], bool* pt) {
} }
if (field[0][2] == 'X') { if (field[0][2] == 'X') {
if (field[0][0] == 'X') { if (field[0][0] == '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[0][0] = '-'){
field[0][0] = 'X'; field[0][0] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[1][1] == 'X') { else if (field[1][1] == 'X') {
if( field[2][0] = '-'){
field[2][0] = 'X'; field[2][0] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[2][0] == 'X') { else if (field[2][0] == 'X') {
if( field[1][1] = '-'){
field[1][1] = 'X'; field[1][1] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[1][2] == 'X') { else if (field[1][2] == '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[1][2] = '-'){
field[1][2] = 'X'; field[1][2] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
} }
if (field[1][0] == 'X') { if (field[1][0] == 'X') {
@ -509,34 +521,46 @@ void fillAlmostFull(char field[3][3], bool* pt) {
} }
if (field[0][2] == 'O') { if (field[0][2] == 'O') {
if (field[0][0] == 'O') { if (field[0][0] == '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[0][0] = '-'){
field[0][0] = 'X'; field[0][0] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[1][1] == 'O') { else if (field[1][1] == 'O') {
if( field[2][0] = '-'){
field[2][0] = 'X'; field[2][0] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[2][0] == 'O') { else if (field[2][0] == 'O') {
if( field[1][1] = '-'){
field[1][1] = 'X'; field[1][1] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
else if (field[1][2] == 'O') { else if (field[1][2] == '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[1][2] = '-'){
field[1][2] = 'X'; field[1][2] = 'X';
*pt = true; *pt = true;
return; return;
}
} }
} }
if (field[1][0] == 'O') { if (field[1][0] == 'O') {

Loading…
Cancel
Save