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][0] == 'X') {
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'X') {
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'X') {
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][1] == 'X') {
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
}
}
}
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][0] == 'O') {
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'O') {
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'O') {
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][1] == 'O') {
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
}
}
}
if (field[2][2] == 'O') {

Loading…
Cancel
Save