Create a JavaFX application that simulates a game of tic-tac-toe. Figure 15-55 shows an example of the application's GUI. The window shown in the figure uses nine ImageView components to display the Xs and Os. (You will find images for the X and the O in the book's Student Sample Files.) The application should use a two-dimensional int array to simulate the game board in mem- ory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element. The number 0 represents the letter O, and the number 1 represents the letter X. The application's window should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 3GZ
icon
Related questions
Question
10. Tic-Tac-Toe Simulator
Create a JavaFX application that simulates a game of tic-tac-toe. Figure 15-55 shows an
example of the application's GUI. The window shown in the figure uses nine ImageView
components to display the Xs and Os. (You will find images for the X and the O in the
book's Student Sample Files.)
The application should use a two-dimensional int array to simulate the game board in mem-
ory. When the user clicks the New Game button, the application should step through the
array, storing a random number in the range of 0 through 1 in each element. The number 0
represents the letter O, and the number 1 represents the letter X. The application's window
should then be updated to display the game board. The application should display a message
indicating whether player X won, player Y won, or the game was a tie.
Tic Tac Toe
X Wins!
New Game
Transcribed Image Text:10. Tic-Tac-Toe Simulator Create a JavaFX application that simulates a game of tic-tac-toe. Figure 15-55 shows an example of the application's GUI. The window shown in the figure uses nine ImageView components to display the Xs and Os. (You will find images for the X and the O in the book's Student Sample Files.) The application should use a two-dimensional int array to simulate the game board in mem- ory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element. The number 0 represents the letter O, and the number 1 represents the letter X. The application's window should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie. Tic Tac Toe X Wins! New Game
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Passing Array as Argument
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT