Browse Source

added validation 2/9

remotes/origin/ticTacToe
Aimee Reincke 2 years ago
parent
commit
93a43ef1a7
  1. 28
      src/c/ticTacToe.c

28
src/c/ticTacToe.c

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

Loading…
Cancel
Save