Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Need help with Tic Tac Toe assignment

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help with Tic Tac Toe assignment

    I have to make a basic tic tac toe game for my class and I am stuck trying to get the board to print out and then I dont know if I am on the right track


    public static void main(String[] args) {


    String[][] board = new String[3][3];


    for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
    int a = 0;

    board[i][j] = "+";
    System.out.println();
    }
    }
    playerX(gameBoard1[i][j]);
    playerO(gameboard2[i][j]);


    }
    public static void playerX(String[][] gameBoard1){
    Scanner input = new Scanner(System.in);
    System.out.println("Please pick a number you want to place an X:");
    String pick = input.nextLine();
    while (pick == gameboard1 [i][j]){

    }

    }
    public static void playerO(String[][] gameBoard2){
    Scanner input = new Scanner(System.in);
    System.out.println("Please pick a number you want to place an O:");
    String pick = input.nextLine();
    while (pick == gameboard2 [i][j]){
    }
    }
    public static void checkBoard(){
    if(baord[0][0] = X && board[0][1] = X )
    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,290
    My Mood
    Hungover
    Thanks
    142
    Thanked 620 Times in 531 Posts

    Default Re: Need help with Tic Tac Toe assignment

    What do you expect your program to do? What does it do instead?

    If you want help, post an SSCCE that demonstrates the problem, and don't forget the highlight tags.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Need help with Tic Tac Toe assignment

    In addition to Kevin's reply, read Common Java Mistakes
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 10:01 AM
  2. please help me in my assignment :(
    By asdfg in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 18th, 2010, 07:59 AM
  3. need help on an assignment :(
    By gamfreak in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 23rd, 2010, 03:20 PM
  4. Replies: 1
    Last Post: February 22nd, 2010, 07:20 AM
  5. Need help with assignment
    By TonyL in forum Loops & Control Statements
    Replies: 2
    Last Post: February 20th, 2010, 08:44 PM