import .*;
import .*;
import .*;
import ;
// THIS APPLICATION USES JAVA's JFRAME FOR GUI PROGRAMMING
// and implements a connection to a MOUSE via ActionListner
public class TTTGUI extends JFrame implements ActionListener
{
private int NoWin=0, xWon=0, oWon=0;
private int move;
final static String BLANK = " ";
final static String X = "X";
final static String O = "O";
final static int NSimulations = 10000;
private String currentPlayer = X;
private static final long serialVersionUID = 6L; // version 6 unique ID number
protected static ponent NULL = null;
// Graphic constants and graphical units.
private final int NCOL = 3; // button columns
private final int N = 9; // total buttons
private final int WIDTH = 50; // size of buttons
private final int HEIGHT = 35;
private final int GAP = 4; // space between buttons
private final int XSTART = 40;
// display keys & buttons
private String[] keys = {" ", " ", " ",
" ", " ", " ",
" ", " ", " ",
};
private JButton[] button = new JButton[N];
Container pane = getContentPane();
public TTTGUI()
{
setTitle("Tic Tac Toe ");
setSize(WIDTH*5, HEIGHT*6+15);
(null);
setUpGUI();
(
new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
java 井字棋 来自淘豆网m.daumloan.com转载请标明出处.