I am a university student (1st year) and I have an assignment to make a Tic Tac Toe console game using the ACM Library. I managed to make it working Player VS Player. Another part of this assignment requires me to make it work like Player VS Computer. The teacher told us not to create an AI but to make the computer ALWAYS win or tie. How can I implement this? I don't think that it is possible to implement that using a lot of if's and else's. Is there any smarter way?
I've created one constructor called Board which has all the methods needed to create, display, update the game board, to check if X's or O's win (or tie), and to check the string that the user inputs (In order to play user must type something like (row_space_column ---> example: "3 1")). I also created another file ("TicTacToe.java") which is the game itself.
So, what are your opinions? (The language i use is JAVA) (Sorry for my English, i am Greek) Thanks!