Here's some newer code that i came up with, but i still need help with outputting the x's and o's in the correct position
CODE
import java.util.Scanner;
public class TicTacToeMain {
public static void main(String[] args) {
int position;
int turn = 0;
boolean result = false;
Scanner keyboard = new Scanner(System.in);
System.out.println ("Welcome to Tic Tac Toe!");
char[][] grid = new char[3][3];
while (result == false) {
if (turn % 2 == 0){
System.out.println ("Player 1, it is your turn");
System.out.println ("Please input the row and column you wish you play on");
int row = keyboard.nextInt();
int col = keyboard.nextInt();
for (int r = 0; r < 3; r ++)
for (int c = 0; c < 3; c++)
grid[row][col]= ' ';
grid[row][col] = 'X';
System.out.println(grid[row][col]);
}
else {
System.out.println ("Player 2, it is your turn");
System.out.println ("Please input the row and column you wish you play on");
int row = keyboard.nextInt();
int col = keyboard.nextInt();
for (int r = 0; r < 3; r ++)
for (int c = 0; c < 3; c++)
grid[row][col]= ' ';
grid[row][col] = 'O';
System.out.println(grid[row][col]);
}
turn += turn;
}
}
}
And for some reason, the turns isn't working either any help?
This post has been edited by GiveMeYourBagel: 8 Nov, 2009 - 01:32 PM