From Aidan Burns, 1 Week ago, written in Java.
This paste will kick the bucket in 10 Months.
Embed
  1. package TickTackToe;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * @aidan 12/18/2019
  7.  * This program does TickTacktoe
  8.  * Cordinates start from top left corner, 0,0 is top left, 2,2 is bottom right
  9.  */
  10. public class TickTackTest {
  11.     public static void main(String[] args) {
  12.         Scanner in = new Scanner(System.in);
  13.         System.out.println("Enter P1 name: ");
  14.         String p1 = in.nextLine();
  15.         System.out.println("Enter p2 name: ");
  16.         String p2 = in.nextLine();
  17.  
  18.  
  19.         TickTackToe Game1 = new TickTackToe(p1, p2);
  20.         while (Game1.stillPlaying()){
  21.             if (Game1.isP1Turn()){
  22.                 print(Game1);
  23.                 System.out.println(p1+" What x spot would you like to play");
  24.                 int x = in.nextInt();
  25.                 System.out.println("What y spot would you like to play");
  26.                 int y = in.nextInt();
  27.                 System.out.println(Game1.play(x,y));
  28.             } else {
  29.                 print(Game1);
  30.                 System.out.println();
  31.                 System.out.println(p2+" What x spot would you like to play");
  32.                 int x = in.nextInt();
  33.                 System.out.println("What y spot would you like to play");
  34.                 int y = in.nextInt();
  35.                 System.out.println(Game1.play(x,y));
  36.             }
  37.         }
  38.         System.out.println("gg");
  39.  
  40.     }
  41.  
  42.     public static void print(TickTackToe game)
  43.     {
  44.         System.out.println();
  45.         for(int r = 0; r < 3; r++)
  46.         {
  47.             for(int c = 0; c < 3; c ++)
  48.             {
  49.                 System.out.print(game.getBoard(c,r));
  50.                 if(c != 2)
  51.                 {
  52.                     System.out.print("|");
  53.                 }
  54.             }
  55.             System.out.println();
  56.             if(r != 2)
  57.             {
  58.                 System.out.println("_____");
  59.             }
  60.         }
  61.     }
  62. }
  63.  

Replies to tick toe rss

Title Name Language When
Re: tick toe Aidan Burns java 1 Week ago.
Re: tick toe Aidan Burns java 1 Week ago.
Re: tick toe Aidan Burns java 1 Week ago.