SHARE
TWEET

TicTacToe2D.java

fosterbl Jan 22nd, 2020 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //(c) A+ Computer Science
  2. //www.apluscompsci.com
  3. //Name -
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class TicTacToe2D
  8. {
  9.    private String[][] mat;
  10.  
  11.    //Reads the String game into the 2D array, mat
  12.    public TicTacToe2D(String game)
  13.    {
  14.    
  15.    
  16.    
  17.    
  18.    }
  19.  
  20.    //returns the winner and how they won or cat's game
  21.    public String getWinner()
  22.    {
  23.    
  24.    
  25.    
  26.    
  27.    
  28.    
  29.    
  30.    
  31.    
  32.    
  33.    
  34.    
  35.       return "";
  36.    }
  37.  
  38.    //returns a String representing the tic tac toe board visually
  39.    public String toString()
  40.    {
  41.       String output="";
  42.    
  43.    
  44.    
  45.    
  46.    
  47.    
  48.       return output+"\n\n";
  49.    }
  50.    
  51.    public static void main(String[] args){
  52.       TicTacToe2D game = new TicTacToe2D("XXXOOXXOO");
  53.       System.out.println( game );
  54.       System.out.println( game.getWinner() );
  55.      
  56.       game = new TicTacToe2D("OXOOXOXOX");
  57.       System.out.println( game );
  58.       System.out.println( game.getWinner() );
  59.      
  60.       game = new TicTacToe2D("OXOXXOXOO");
  61.       System.out.println( game );
  62.       System.out.println( game.getWinner() );
  63.      
  64.       game = new TicTacToe2D("OXXOXOXOO");
  65.       System.out.println( game );
  66.       System.out.println( game.getWinner() );
  67.      
  68.       game = new TicTacToe2D("XOXOOOXXO");
  69.       System.out.println( game );
  70.       System.out.println( game.getWinner() );
  71.    }
  72. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top