diff --git a/src/TicTacToe.c b/src/TicTacToe.c index 96e9e05..108db1a 100644 --- a/src/TicTacToe.c +++ b/src/TicTacToe.c @@ -11,8 +11,40 @@ int main() { int pos7 = 7; int pos8 = 8; int pos9 = 9; + int o = 0; 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."); + + } + drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); + + return 0; } void drawBoard(int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9) {