Advertisement
Kerine

Untitled

Nov 25th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.08 KB | None | 0 0
  1. import java.util.*;
  2. /**
  3.  * Write a description of class Main here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class Main
  9. {
  10.     public static int whoseTurn=0;
  11.     public static void main (String [] args)
  12.     {
  13.         Scanner k=new Scanner (System.in);
  14.         ArrayList<Piece> playerPieces=new ArrayList<Piece> ();
  15.         ArrayList<Piece> compPieces=new ArrayList<Piece> ();
  16.         //Display a popup which asks the user for rows and columns.
  17.         AskPopup a=new AskPopup ();
  18.         a.display ();
  19.         //Wait for the user to input parameters
  20.         while (!a.getEntered ()==true)
  21.         {
  22.             try {
  23.                 Thread.sleep (1000L);
  24.             }
  25.             catch (Exception e){}
  26.         }
  27.         int l=a.getL ();
  28.         int w=a.getW ();
  29.         //Create a board and display it, using the width and length entered.
  30.         Board b=new Board (w, l, playerPieces, compPieces);
  31.         b.display ();
  32.         //---------------------------------------------------------------------------------------------
  33.         //Begin Playing Part
  34.         Player p=new Player ();
  35.         Computer c=new Computer ();
  36.         playerPieces=p.getPieces ();
  37.         compPieces=c.getPieces();
  38.                 if (p.getPieces()==playerPieces)
  39.         {
  40.             System.out.println (";_;");
  41.         }
  42.         while (!p.hasWon()&&!c.hasWon ())
  43.         {
  44.             if (whoseTurn==0)
  45.             {
  46.                 p.takeTurn ();
  47.                 playerPieces=p.getPieces ();
  48.                 b=new Board (w, l, playerPieces, compPieces);
  49.                 b.display();
  50.                 whoseTurn++;
  51.             }
  52.             else
  53.             {
  54.                 c.takeTurn (playerPieces, w, l);
  55.                 compPieces=c.getPieces ();
  56.                 b=new Board (w, l, playerPieces, compPieces);
  57.                 b.display();
  58.                 whoseTurn--;
  59.             }
  60.         }
  61.         System.out.println ("YAAAAAAAAY");
  62.         //b.showResult();
  63.         //if (b.another ())
  64.         //{
  65.         //    main ();
  66.         //}
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement