Write a program that can play tic-tac-toe. To do this you will need to create a
ID: 3532141 • Letter: W
Question
Write a program that can play tic-tac-toe. To do this you will need to create a game tree, which is a tree where each node corresponds to a game congifuration, which , in this case is a representation of the tic tac toe board. The root node corresponds to the initial configuration. For each internal node c in T, the children of v correspond to the game states we can reach from v
Explanation / Answer
/* Title: Tic-Tac-Toe Game See Below... */ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; public class TicTacToe implements ActionListener { final String VERSION = "1.0"; //Setting up ALL the variables JFrame window = new JFrame("Tic-Tac-Toe " + VERSION); JMenuBar mnuMain = new JMenuBar(); JMenuItem mnuNewGame = new JMenuItem("New Game"), mnuInstruction = new JMenuItem("Instructions"), mnuExit = new JMenuItem("Exit"), mnuAbout = new JMenuItem("About"); JButton btn1v1 = new JButton("Player vs Player"), btn1vCPU = new JButton("Player vs CPU"), btnBack = new JButton("Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.