aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "any advice?" Watch "any advice?" New topic
Author

any advice?

jesse johnson
Greenhorn

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.
Barry
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

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: http://aspose.com/file-tools
 
subject: any advice?
 
Similar Threads
Game Tutorials -->> TicTacToe
TicTacToe! Stop user from changing input
TicTacToe Game
TicTacToe Game..
TicTacToe game