Two Laptop Bag
The moose likes Beginning Java and the fly likes any advice? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "any advice?" Watch "any advice?" New topic

any advice?

jesse johnson

Joined: Jun 14, 2001
Posts: 6
i have no idea where to go with this:
public class TicTacToe {
private String board[][] = new String[3][3];
private String X = " X ";
private String O = " O ";
private String blank = " ";

//constructor - defaults to an empty board of 3x3 positions
public TicTacToe();
for (int i = 0; i< board.length; i++)
for (int j = 0; j < board[i].length; j++)
board[i][j] = blank;

//attempts to mark a position for the player. returns
//false if position is already taken
private boolean move (int player, int position);
//asks user for position. use and validate 1 - 9;
//1 2 3
//4 5 6
//7 8 9
//make sure move is valid
private int getMove();
//returns the following:
//0 - no winner yet; 1 - player 1 wins; 2 - player 2 wins; 3 - tie game
private int checkWinner();
//display board
private void displayBoard();
//contains the logic for playing the game. sets up general play action of:
//display board
//asks player 1 to move
//check for winner
//display board
//ask player 2 to move
//check for winner
//repeat steps until winner or tie.
public void play();

public static void main (string args []) {
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

Noone else knows where to go either because you did not ask a question. What specifically are you trying to do? I doubt if anyone here is going to write your program for you.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

I got something here. It uses more classes (which is a good thing) than you have, it isn't complete and I didn't try and compile it. And of course the code goes into 3 different files. Let me know if you have any questions about it.

Please ignore post, I have no idea what I am talking about.
I agree. Here's the link:
subject: any advice?
It's not a secret anymore!