//
// PokerCardDeck.java
// Copyright (c) 1997 by Hidetaka Manu- Masuda
// This class is for HitoriPoker.java.
// Non-Commercial use only.
// 

import java.awt.*;
import java.applet.Applet;
import java.io.*;

public class PokerCardDeck {

    private PokerCard cards[]; 
    private int count;

    int getCount() {
        return count;
    }

    PokerCard getCurrent() {
        return cards[count];
    }

    PokerCard getNext() {
        count = (count +1) % 52;
        return getCurrent();
    }

    void shuffle() {
        int rand1, rand2, i;
        PokerCard tmp;

        for (i=1; i<10000; i++) {
              rand1 = (int)(Math.random()*52.0);
              rand2 = (int)(Math.random()*52.0);
            tmp = cards[rand1];
            cards[rand1] = cards[rand2];
              cards[rand2] = tmp;
        }
    }

    PokerCardDeck() {
	super();
        int num, mark;
        PokerCard newCard;
        cards = new PokerCard[52];
        count = 0;
        for(mark=0; mark<=3; mark++) {
            for(num=1; num<=13; num++) { 
                newCard = new PokerCard();
                newCard.setMark(mark);
                newCard.setNumber(num);
                cards[num-1+(mark*13)] = newCard;
          }
        }
    }
}
