Computers and Technology
Computers and Technology, 17.02.2020 17:06, keke6361

You are to write a game called gato. That is Tic-Tac-Toe, for those of you that have not heard the name in Spanish. First you need to draw the board using classes from the graphics library discussed in class. Next, ask the user to click on a empty spot on the board and display alternating X’s and O’s on the locations of those mouse clicks. After 9 clicks, presumably when the board has been filled up, the game ends. You must display a "Game over" message somewhere on the viewing window and proceed to ask the user whether or not another game is to be played. The program should end when the user enters a negative response to this question.

For this assignment you may assume:

The user knows how to play the game; that is, once a location of the board is occupied, the user will not try to click on that location again unless a new game has started.

The game ends after 9 clicks regardless of whether or not there is an actual winner.

The player who draws the O’s always gets to start the game (i. e., when the board is empty the first symbol displayed will be an O).

Notice that there could be many individual games of gatoevery time the program is run. You will not know in advance whether the user wants to play 1, or 100 games; your program should adjust accordingly. Also, notice that at every individual game, exactly 5 O’s and 4 X’s are to be drawn.

The purpose of this assignment is that you code your program efficiently. You should not repeat the procedure for drawing an O or an X more than necessary. In other words, you should loop the part of your code that performs the drawing rather than simply repeating your code multiple times.

Here is some more information about your assignment:

You are not expected to write code that plays the game of Tic-Tac-Toe against the user. Instead, the user will choose all locations for all of the O’s and all of the X’s.

You are not responsible for tracking poor mouse clicks by the user, such as not clicking within a box or a user clicking all 9 X’s and O’s in the same box (remember: you are under the assumption that the user knows how to play the game).

You are not responsible for deciding whether or not there is a winner.

(+1 point) Instead of drawing an O, sketch a guajolotero bus. To get this point, it should be absolutely clear that your sketch indeed represents a guajolotero bus and not just a generic bus.
(+1 point) End the game at the first occurrence of a 3-in-a-row. In this case, a line through the winning 3 spots must be drawn and you must declare the winner: O or X.
(+2 points) Write an intelligent Tic-Tac-Toe playing system so that the computer plays against the user.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:20, autumnguidry1622
Write a method replacekey in the minheap class with the following signature: public void replacekey(integer oldkey, integer newkey) the method will replace the first occurrence of oldkey with the newkey, and restore the min-heap property after the change. if the oldkey does not exist in the heap, the method prints an appropriate message and returns without changing the heap. example: suppose our binary heap object (bh) has the following keys: *** 4 6 7 32 19 64 26 99 42 54 28 then the method call: bh. replacekey (oldkey integer(54), newkey integer(2))
Answers: 1
image
Computers and Technology, 22.06.2019 17:00, joshualoz5414
Acase study allows a more detailed look at the life of a single subject than any other study.
Answers: 3
image
Computers and Technology, 23.06.2019 15:00, lopez7512
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
image
Computers and Technology, 24.06.2019 22:00, sierrawalk2283
True or false technology is often discovered by accident
Answers: 2
Do you know the correct answer?
You are to write a game called gato. That is Tic-Tac-Toe, for those of you that have not heard the n...

Questions in other subjects:

Konu
History, 20.05.2021 01:00
Konu
Mathematics, 20.05.2021 01:00