Created
September 13, 2020 21:07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tictactoe; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in).useDelimiter(""); | |
char[][] state = new char[3][3]; | |
int i = 0; | |
int j = 0; | |
int size = state.length - 1; | |
System.out.print("Enter cells: "); | |
while (scanner.hasNext()) { | |
state[i][j] = scanner.next().charAt(0); | |
if (j < size) { | |
j++; | |
} else if ( i < size) { | |
j = 0; | |
i++; | |
} else { | |
break; | |
} | |
} | |
TikTakToeGame game = new TikTakToeGame(state); | |
System.out.println(game.getState()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment