Browse Source

added validation 6/9

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

16
src/c/ticTacToe.c

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

Loading…
Cancel
Save