Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- /**
- * Write a description of class Main here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Main
- {
- public static int whoseTurn=0;
- public static void main (String [] args)
- {
- Scanner k=new Scanner (System.in);
- ArrayList<Piece> playerPieces=new ArrayList<Piece> ();
- ArrayList<Piece> compPieces=new ArrayList<Piece> ();
- //Display a popup which asks the user for rows and columns.
- AskPopup a=new AskPopup ();
- a.display ();
- //Wait for the user to input parameters
- while (!a.getEntered ()==true)
- {
- try {
- Thread.sleep (1000L);
- }
- catch (Exception e){}
- }
- int l=a.getL ();
- int w=a.getW ();
- //Create a board and display it, using the width and length entered.
- Board b=new Board (w, l, playerPieces, compPieces);
- b.display ();
- //---------------------------------------------------------------------------------------------
- //Begin Playing Part
- Player p=new Player ();
- Computer c=new Computer ();
- playerPieces=p.getPieces ();
- compPieces=c.getPieces();
- if (p.getPieces()==playerPieces)
- {
- System.out.println (";_;");
- }
- while (!p.hasWon()&&!c.hasWon ())
- {
- if (whoseTurn==0)
- {
- p.takeTurn ();
- playerPieces=p.getPieces ();
- b=new Board (w, l, playerPieces, compPieces);
- b.display();
- whoseTurn++;
- }
- else
- {
- c.takeTurn (playerPieces, w, l);
- compPieces=c.getPieces ();
- b=new Board (w, l, playerPieces, compPieces);
- b.display();
- whoseTurn--;
- }
- }
- System.out.println ("YAAAAAAAAY");
- //b.showResult();
- //if (b.another ())
- //{
- // main ();
- //}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement