Results 1 to 5 of 5

Thread: TicTacToe

  1. #1
    Joe3161 is offline Member
    Join Date
    Oct 2007
    Location
    AZ
    Posts
    2
    Rep Power
    0

    Default TicTacToe

    /*Can someone help me with this, I can't seem to find the error it keeps erring at Void. Thanks*/


    Java Code:
    import java.util.*;
    
    public class TicTacToeJNR
    {
    	public int currentTurn, entryCount, setupBoard;
    	public int getMove, writeBoard;
    
    	private static char [][] board = new char [3][3];
    
    	private static char currentTurn;
    
    }
    	public static void main(String[] args)
    	{
    		setupBoard ();
    		entryCount = O;
    		currentTurn = X;
    		for (entryCount = O; entryCount <9 entryCount ++)
    		{
    			getMove ();
    			writeBoard();
    			if (currentTurn == 'X')
    			currentTurn = 'O';
    			else currentTurn = 'X';
    		}
    		System.out.println ("Game Over");
    
    	        row = keyboard.nextInt ();
    			col = keyboard.nextInt ();
    		    board [row-1][col-1] = currentTurn;
    
    	public static void setupBoard ()
    	{
    		int row;
    		int col;
    		for (row = O; row <3; row ++
    		{
    			board [row] [col] = '+');
    		}
    		private static void setupBoard()
    		{
    			int row;
    			int col;
    			for (col = O; col <3; col ++)
    			{
    				board [row][col] = '+';
    			}
    		}
    
        }
    Last edited by JavaBean; 10-29-2007 at 07:51 AM. Reason: Code placed inside [code] tag.

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    Hi,

    Next time please place your code inside [code] tag.

    Can you write the exact error message?

  3. #3
    Joe3161 is offline Member
    Join Date
    Oct 2007
    Location
    AZ
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by JavaBean View Post
    Hi,

    Next time please place your code inside [code] tag.

    Can you write the exact error message?
    Sorry, I am new to this.

    java:13 'class or 'interface' expected
    public static void main(String[] args)
    ^

  4. #4
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    Java Code:
    	private static char currentTurn;
    
    }
    Check curly bracket after your variable declaration above. It closes your class! You should remove that.

  5. #5
    abdo_elrahman is offline Member
    Join Date
    Nov 2007
    Posts
    1
    Rep Power
    0

    Default

    hi every one
    i wanna to ask question about this applications
    i wanna to do things like system calls in linux or win32 api
    exactly what is needed that i wanna to make application that will create shared memory in memory then using semaphors or any thing like it any one can access this semaphor and only is who updating in shared memory

    any thing like this is found in java or not ?
    and if yes or can be implemented can i run game like this game and then can run no of it then these application will play with each other no any interrupt from the user
    i wanna to implement scenario like this
    i know this can be easily using system calls over linux but iam suffering in java
    can any one help me .............. :( ?
    thanks very much

Similar Threads

  1. TicTacToe
    By Thomas Covington in forum New To Java
    Replies: 1
    Last Post: 04-10-2008, 04:51 AM
  2. TicTacToe Game
    By Ebtihal in forum New To Java
    Replies: 0
    Last Post: 01-09-2008, 11:01 AM
  3. disabling JButtons after win in TicTacToe
    By noisepoet in forum New To Java
    Replies: 1
    Last Post: 05-18-2007, 11:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •