Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bryanluzada;
- import java.util.*;
- public class BryanLuzada {
- public static void main(String[] args) {
- Scanner bl = new Scanner(System.in);
- int moveB = 0;
- int moveL = 0;
- String tic [] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",};
- int x = 0;
- while(x != 1)
- {
- moveB = bl.nextInt();
- tic[moveB] = "X";
- if(tic[moveB].equals(tic[moveL]))
- {
- System.out.println("The spot has been taken by the opponent!");
- }
- else
- {
- printTic(tic);
- }
- moveL = bl.nextInt();
- tic[moveL] = "O";
- if(tic[moveL].equals(tic[moveB]))
- {
- System.out.println("The spot has been taken by the opponent!");
- }
- else
- {
- printTic(tic);
- }
- }
- }
- public static void printTic(String tic[])
- {
- System.out.println(tic[1] + " " + tic[2] + " " + tic[3]);
- System.out.println(tic[4] + " " + tic[5] + " " + tic[6]);
- System.out.println(tic[7] + " " + tic[8] + " " + tic[9]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement