All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pat.apps.Deck

java.lang.Object
   |
   +----pat.apps.Deck

public class Deck
extends Object
An interface to java.util.Random which simulates a deck of "cards." Actually, it just supplies random numbers from 0 to ncards()-1 without ever repeating a number. Thus, you can think of each integer in this range as a card.


Variable Index

 o r
The random number generator this class uses.

Constructor Index

 o Deck(int)
Initialize the size of the deck.

Method Index

 o discard(int)
 o draw()
 o ncards()
The number of cards remaining in this object.

Variables

 o r
  public Random r
The random number generator this class uses.

Constructors

 o Deck
  public Deck(int ncards)
Initialize the size of the deck. The deck has a number of cards equal to "ncards" in it.

Methods

 o ncards
  public int ncards()
The number of cards remaining in this object.

 o discard
  public void discard(int n)
 o draw
  public int draw()

All Packages  Class Hierarchy  This Package  Previous  Next  Index