Question
Needs help with Javafx Programming language Your task is to write a Java application to play the game of tic-tac-toe. this is a human player
Needs help with Javafx Programming language
Your task is to write a Java application to play the game of tic-tac-toe.
this is a human player VS computer player game
The game of tic-tac-toe is played on a 3x3 grid of cells buttons. One player is designated as X and the other is O. The X player always goes first and places an X symbol on one of the nine empty cells. The O player then responds by placing an O symbol on one of the remaining unmarked cells. The players continue to alternate turns placing their symbols on open cells until one player successfully places three symbols in a horizontal, vertical, diagonal line to win the game or all the cells are filled resulting in a draw.
Your game should be designed to allow a human player to compete against a computer player.
Your program should include the following classes:
1. The Board class to maintain the status of the game (i.e. locations of Xs and Os) along with suitable methods to update the board status and determine board configuration is a win for X, win for O, or a draw.
2. The Computer Player class to generate choices for placement of next O based on the current status of the board.
3. The Score Keeper class to record the number of times each player, human and computer, win.
4. A graphical user interface constructed using JavaFX to provide a visual representation of the board, a display of the number of wins and losses for each player, and suitable mouse actions to support the human players selection of where to place Xs and the computer to respond by placing an O.
Your game should be designed to allow a human player to compete against a computer player.
allow the user to play X and go first. The computer player will play O and respond to the human players choices. Design the computer player to make a random choice of where to place the next O among the open cells.
Your program should always display the score (human and computer) and provide a message when the human wins, loses or draws. After each game ends, your program should reset the board to play another game. The user can terminate the series of games by closing the GUI.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started