Question: This is a computer science assignment called Tic Tac Toe. Please help me do this part of the assignment. A method called checkForObviousMove that takes
A method called checkForObviousMove that takes the board as input and returns true if there's an "obvious move" the AI should do, false otherwise. We consider to be an "obvious move" a move that would make the Al either win or avoid an obvious win for the user on the next turn. If such a move exist, then the method should carry it out by calling the writeOnBoard method with the appropriate inputs, and then return true. Note that the AI should chose to win the game over blocking an obvious win for the user. Remember also that the AI always uses the symbol 'o', while the user uses x'. If no obvious move is possible, then the method should simply return false. For example, consider the following array of characters: Then the obvious move for the Al is to place its mark (o') in position (0,1) since this would make the AI win the game. Therefore, if the method checkForObviousMove is called with input a, then after the call is executed, the array will be equal to {('x' , o, , , } , {", o, , , }, ('x, , o, , ,)) and the method will return true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
