/*
 *	
 *  Filename: GuessModel.java
 *  Java Application: GuessModel
 *  Author: Achim E Karger
 *  Course: CSCI 111 Java I
 *  Assignment: Lab 7
 *  Date:   April 21, 2008
 *  compiler JCreator LE
 *
 */
 
import java.util.Random;

/**
 * GuessModel provides a 'deck' of 16 numbers underlying the guessing game. 
 *  The deck contains two instances each of numbers (0-7) which are randomized.
 *  Each element of the deck represents one of the tiles in the 4x4 game board,
 *  The deck can be  re-shuffled by calling the instance method shuffleDeck()
 *
 * @author  Achim E Karger
 * @version 1.0 04/28/08
 * @see     java.lang.System
 */
public class GuessModel{
	protected static final int NUM_TILES = 16;  
	protected int[] theDeck;
    private Random generator;

   public GuessModel(){
   	generator = new Random();
   	theDeck = new int[NUM_TILES];
   	for(int i=0;i<NUM_TILES;i++)
   		theDeck[i] = i/2;
   	shuffleDeck();
   	} // end constructor

	public void shuffleDeck(){
      int num, temp;
      for(int i=0;i<NUM_TILES;i++)	{
      	num = generator.nextInt(NUM_TILES);
      	temp = theDeck[i];
      	theDeck[i] = theDeck[num];
      	theDeck[num] = temp;
      }
	}	// end shuffleDeck
	
}
		
		
