Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions