import java.util.*;
import java.io.*;

/**
 *
 * This class does some testing of class ListDeck.
 *
 * You must not modify this class.
 *
 */

public class DeckDriver {

   public static BufferedReader inKey = 
       new BufferedReader(new InputStreamReader(System.in));
       
   // The file from which cards will be read.
   public static MyStreamTokenizer inFile;
   
   // Seed for the random number stream.
   public static int seed;
   
   // The random number stream.
   public static MyRandom myRandom;
   
   // The deck of cards.
   public static Deck theDeck = new ListDeck();

   // The number of players.
   public static int numberOfPlayers;
   
   
   public static void main(String[] args) throws 
        IOException {
   
       // Read the seed and instantiate the random number stream.
       System.out.print("Enter random seed value :");
       seed = Integer.parseInt(inKey.readLine());
   
       myRandom = new MyRandom(seed);
   
       // Read the number of players.
       System.out.print("Enter number of players :");
       numberOfPlayers = Integer.parseInt(inKey.readLine());
      
       while(true) {
           System.out.print("Enter the name of the file " +
                            "describing the cards: ");
           String inFileName = inKey.readLine().trim();
           try {
               inFile = new MyStreamTokenizer(inFileName);
               break;
           } catch (FileNotFoundException e) {
               System.out.println("Can't find file: "+inFileName);
               System.out.println("Try again.");
           }
       }
   
       theDeck.loadDeck(inFile);
   
       theDeck.shuffle(myRandom);
   
       theDeck.deal(numberOfPlayers);
   
   }
   
}
