File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes help with game Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help with game" Watch "help with game" New topic

help with game

federico elbl

Joined: Oct 14, 2003
Posts: 13
could somebody give me a detailed explanation of how this tictactoe game program works?
thanks you. this is the code:
import javax.swing.*;
import java.awt.*;
import java.applet.*;
public class TicTac extends JApplet
public void init()
// declaration aand created array
int Array[] = new int[8];
String input1;
String input2;
int choice1 = 0;
int choice2;
for(int i=0; i < Array.length; i++) Array = 0;
while (choice1 == 0)
input1 = JOptionPane.showInputDialog
("Please select your symbol\n"+
"1= O \n"+
"2= X \n");
if (input1.equals("1")) choice1 = 1;
if (input1.equals("2")) choice1 = 2;
//converts string to integer
//choice1 = Integer.parseInt( input1 );
// draws the TicTacToe Board...
public void paint(Graphics g)
Dimension d = getSize();
int sz = 0;
if (d.height/4 - 10 < d.width/4) sz = d.height / 4;
elsesz = d.width / 4;
for (int j=0; j < 4; j++)
} //end of paitn method
}// end of class
Joe Ess

Joined: Oct 29, 2001
Posts: 9169

Originally posted by federico elbl:
could somebody give me a detailed explanation of how this tictactoe game program works?

I will bet it doesn't do much. Is this a class assignment?

[How To Ask Questions On JavaRanch]
Mathias Nilsson
Ranch Hand

Joined: Oct 13, 2003
Posts: 107
Have you tried to compile it?
It has some errors. Try to compile it and see what it does.

SCJP2 , MCP( 70-229 ) , Preparing For SCWDC
I agree. Here's the link:
subject: help with game
It's not a secret anymore!