simple tic tac toe

heres my code: my question is at the bottom

import apcslib.*;

import chn.util.*;

public class TicTacToe

{

public static void main(String[] args)

{

//variables and objects

TicTac one = new TicTac();

SketchPad paper = new SketchPad(500,500);

DrawingTool pen = new DrawingTool(paper);

ConsoleIO console = new ConsoleIO();

System.out.print("Choose who's turn it is:");

String choose = console.readToken();

char variable = choose.charAt(0);

if(variable == 'O' || variable == 'o')

{

System.out.println("1: Top Left Corner");

System.out.println("2: Top Middle");

System.out.println("3: Top Right Corner");

System.out.println("4: Middle Left");

System.out.println("5: Middle");

System.out.println("6: Middle Right");

System.out.println("7: Bottem Left Corner");

System.out.println("8: Bottom Middle");

System.out.println("9: Bottom Right Corner");

System.out.print("Choose where you want to put your mark by picking its number:");

int choice = console.readInt();

if(choice == 1)

{

one.board();//draws a tic tac toe board

one.circle(-120, 65); //draws a circle at that location

}

else if(choice == 2);

{

one.board();

one.circle(-50, 65);

}

}

}

}

now my question, if i input 1 it draws the circle but it then continues on and draws the second circle to without me telling it to. but if i skip right to drawing the second circle it does and ignores the first one. thanks in advance for any input

[1644 byte] By [Little_John_Newa] at [2007-9-29 19:55:20]
# 1

if(choice == 1)

{

one.board();//draws a tic tac

one.circle(-120, 65); //draws a

}

else if(choice == 2);

{

one.board();

one.circle(-50, 65);

}

Take the semicolen off of the second condition.It should be " if ( choice == 2 ) { ".Otherwise, the compiler thinks there is nothing to be executed as the result of choice == 2, and the instructions to draw the second circle are a seperate block of code that gets executed regardless of whether the choice is one, two, or fifteen billion.

TheDavida at 2007-7-15 21:55:51 > top of Java-index,Other Topics,Java Game Development...
# 2
alrighty thanks. cant believe i didnt see that.
Little_John_Newa at 2007-7-15 21:55:51 > top of Java-index,Other Topics,Java Game Development...