Browse Source

added validation 5/9

remotes/origin/ticTacToe
Aimee Reincke 2 years ago
parent
commit
2b8f929ebe
  1. 112
      src/c/ticTacToe.c

112
src/c/ticTacToe.c

@ -156,42 +156,42 @@ void getComputerInput(char field[3][3]){
void fillAlmostFull(char field[3][3], bool* pt) {
if (field[0][0] == 'X') {
if (field[0][1] == 'X') {
if( field[0][2] = '-'){
if( field[0][2] == '-'){
field[0][2] = 'X';
*pt = true;
return;
}
}
else if (field[0][2] == 'X') {
if( field[0][1] = '-'){
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[1][0] == 'X') {
if( field[2][0] = '-'){
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'X') {
if( field[1][0] = '-'){
if( field[1][0] == '-'){
field[1][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'X') {
if( field[2][2] = '-'){
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'X') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
@ -200,28 +200,28 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[0][1] == 'X') {
if (field[0][0] == 'X') {
if( field[0][2] = '-'){
if( field[0][2] == '-'){
field[0][2] = 'X';
*pt = true;
return;
}
}
else if (field[0][2] == 'X') {
if( field[0][0] = '-'){
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'X') {
if( field[2][1] = '-'){
if( field[2][1] == '-'){
field[2][1] = 'X';
*pt = true;
return;
}
}
else if (field[2][1] == 'X') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
@ -230,42 +230,42 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[0][2] == 'X') {
if (field[0][0] == 'X') {
if( field[0][1] = '-'){
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][1] == 'X') {
if( field[0][0] = '-'){
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'X') {
if( field[2][0] = '-'){
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'X') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
}
}
else if (field[1][2] == 'X') {
if( field[2][2] = '-'){
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'X') {
if( field[1][2] = '-'){
if( field[1][2] == '-'){
field[1][2] = 'X';
*pt = true;
return;
@ -274,28 +274,28 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[1][0] == 'X') {
if (field[1][1] == 'X') {
if( field[1][2] = '-'){
if( field[1][2] == '-'){
field[1][2] = 'X';
*pt = true;
return;
}
}
else if (field[1][2] == 'X') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][0] == 'X') {
if( field[2][0] = '-'){
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'X') {
if( field[0][0] = '-'){
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
@ -304,44 +304,60 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[1][1] == 'X') {
if (field[1][0] == 'X') {
if( field[1][2] == '-'){
field[1][2] = 'X';
*pt = true;
return;
}
}
else if (field[1][2] == 'X') {
if( field[1][0] == '-'){
field[1][0] = 'X';
*pt = true;
return;
}
}
else if (field[0][1] == 'X') {
if( field[2][1] == '-'){
field[2][1] = 'X';
*pt = true;
return;
}
}
else if (field[2][1] == 'X') {
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][0] == 'X') {
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'X') {
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
}
}
else if (field[0][2] == 'X') {
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'X') {
if( field[0][2] == '-'){
field[0][2] = 'X';
*pt = true;
return;
}
}
}
if (field[1][2] == 'X') {
@ -455,42 +471,42 @@ void fillAlmostFull(char field[3][3], bool* pt) {
if (field[0][0] == 'O') {
if (field[0][1] == 'O') {
if( field[0][2] = '-'){
if( field[0][2] == '-'){
field[0][2] = 'X';
*pt = true;
return;
}
}
else if (field[0][2] == 'O') {
if( field[0][1] = '-'){
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[1][0] == 'O') {
if( field[2][0] = '-'){
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'O') {
if( field[1][0] = '-'){
if( field[1][0] == '-'){
field[1][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'O') {
if( field[2][2] = '-'){
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'O') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
@ -499,28 +515,28 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[0][1] == 'O') {
if (field[0][0] == 'O') {
if( field[0][2] = '-'){
if( field[0][2] == '-'){
field[0][2] = 'X';
*pt = true;
return;
}
}
else if (field[0][2] == 'O') {
if( field[0][0] = '-'){
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'O') {
if( field[2][1] = '-'){
if( field[2][1] == '-'){
field[2][1] = 'X';
*pt = true;
return;
}
}
else if (field[2][1] == 'O') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
@ -529,42 +545,42 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[0][2] == 'O') {
if (field[0][0] == 'O') {
if( field[0][1] = '-'){
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][1] == 'O') {
if( field[0][0] = '-'){
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
}
}
else if (field[1][1] == 'O') {
if( field[2][0] = '-'){
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'O') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
}
}
else if (field[1][2] == 'O') {
if( field[2][2] = '-'){
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'O') {
if( field[1][2] = '-'){
if( field[1][2] == '-'){
field[1][2] = 'X';
*pt = true;
return;
@ -573,28 +589,28 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[1][0] == 'O') {
if (field[1][1] == 'O') {
if( field[1][2] = '-'){
if( field[1][2] == '-'){
field[1][2] = 'X';
*pt = true;
return;
}
}
else if (field[1][2] == 'O') {
if( field[1][1] = '-'){
if( field[1][1] == '-'){
field[1][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][0] == 'O') {
if( field[2][0] = '-'){
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'O') {
if( field[0][0] = '-'){
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
@ -603,44 +619,60 @@ void fillAlmostFull(char field[3][3], bool* pt) {
}
if (field[1][1] == 'O') {
if (field[1][0] == 'O') {
if( field[1][2] == '-'){
field[1][2] = 'X';
*pt = true;
return;
}
}
else if (field[1][2] == 'O') {
if( field[1][0] == '-'){
field[1][0] = 'X';
*pt = true;
return;
}
}
else if (field[0][1] == 'O') {
if( field[2][1] == '-'){
field[2][1] = 'X';
*pt = true;
return;
}
}
else if (field[2][1] == 'O') {
if( field[0][1] == '-'){
field[0][1] = 'X';
*pt = true;
return;
}
}
else if (field[0][0] == 'O') {
if( field[2][2] == '-'){
field[2][2] = 'X';
*pt = true;
return;
}
}
else if (field[2][2] == 'O') {
if( field[0][0] == '-'){
field[0][0] = 'X';
*pt = true;
return;
}
}
else if (field[0][2] == 'O') {
if( field[2][0] == '-'){
field[2][0] = 'X';
*pt = true;
return;
}
}
else if (field[2][0] == 'O') {
if( field[0][2] == '-'){
field[0][2] = 'X';
*pt = true;
return;
}
}
}
if (field[1][2] == 'O') {

Loading…
Cancel
Save