|
@ -15,35 +15,38 @@ int main() { |
|
|
|
|
|
|
|
|
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); |
|
|
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); |
|
|
|
|
|
|
|
|
int in; |
|
|
|
|
|
printf("Choose a number: "); |
|
|
|
|
|
scanf("%d", &in); |
|
|
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
|
|
|
|
if (pos1 == in) { |
|
|
|
|
|
pos1 = o; |
|
|
|
|
|
} else if (pos2 == in) { |
|
|
|
|
|
pos2 = o; |
|
|
|
|
|
} else if (pos3 == in) { |
|
|
|
|
|
pos3 = o; |
|
|
|
|
|
} else if (pos4 == in) { |
|
|
|
|
|
pos4 = o; |
|
|
|
|
|
} else if (pos5 == in) { |
|
|
|
|
|
pos5 = o; |
|
|
|
|
|
} else if (pos6 == in) { |
|
|
|
|
|
pos6 = o; |
|
|
|
|
|
} else if (pos7 == in) { |
|
|
|
|
|
pos7 = o; |
|
|
|
|
|
} else if (pos8 == in) { |
|
|
|
|
|
pos8 = o; |
|
|
|
|
|
} else if (pos9 == in) { |
|
|
|
|
|
pos9 = o; |
|
|
|
|
|
} else { |
|
|
|
|
|
printf("Not Available."); |
|
|
|
|
|
|
|
|
// Spielschleife |
|
|
|
|
|
for (int i = 0; i < 9; i++) { |
|
|
|
|
|
int in; |
|
|
|
|
|
printf("Choose a number: "); |
|
|
|
|
|
scanf("%d", &in); |
|
|
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
|
|
|
|
if (pos1 == in) { |
|
|
|
|
|
pos1 = o; |
|
|
|
|
|
} else if (pos2 == in) { |
|
|
|
|
|
pos2 = o; |
|
|
|
|
|
} else if (pos3 == in) { |
|
|
|
|
|
pos3 = o; |
|
|
|
|
|
} else if (pos4 == in) { |
|
|
|
|
|
pos4 = o; |
|
|
|
|
|
} else if (pos5 == in) { |
|
|
|
|
|
pos5 = o; |
|
|
|
|
|
} else if (pos6 == in) { |
|
|
|
|
|
pos6 = o; |
|
|
|
|
|
} else if (pos7 == in) { |
|
|
|
|
|
pos7 = o; |
|
|
|
|
|
} else if (pos8 == in) { |
|
|
|
|
|
pos8 = o; |
|
|
|
|
|
} else if (pos9 == in) { |
|
|
|
|
|
pos9 = o; |
|
|
|
|
|
} else { |
|
|
|
|
|
printf("Try again. "); |
|
|
|
|
|
i--; // wiederholen |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); |
|
|
} |
|
|
} |
|
|
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|