heineman
Class Klondike

java.lang.Object
  |
  +--Solitaire
        |
        +--heineman.Klondike

public class Klondike
extends Solitaire

Standard Klondike PlugIn.

Layout: Deal seven packets of cards in a row, all face down. The first consists of one card, the second of two, the third of three, and so on to the seventh of seven. Then turn the top card of each packet face up.

Object: To found the four Aces as and when they appear, and to build each one up in suit and sequence to the King.

Play: Turn cards from the deck and play them if possible or else discard them face up to a single wastepile. Exposed cards on the packets are to be packed in descending sequence and alternating color, with their constituent cards spread towards you in columns. A card or properly packed sequence of cards may be transferred from one column to another provided that the join follows the descending-alternating rule. Whenever a down-card is exposed, turn it face up. Whenever a space is made by clearing out a column, fill it only with a King (and any other cards that may be packed upon it in proper sequence). Multiple cards can be moved at once. There is no redeal.

Note: In traditional "solitaire" as we know it in America, three cards are dealt at a time, and any card can be placed on an empty column; so pay attention to the rules above:

Note: As part of the implementation of Klondike, all controllers ensure that a ColumnView object is being dragged; this simplifies some logic, but adds some complexity to the WastePile controller, who manages the PileView object; see WastePileController for details.

Creation date: (11/9/01 9:44:37 PM)

See Also:
Serialized Form

Field Summary
static int dealCard
          Move Types.
protected  Deck deck
          Each Game has a Deck.
protected  DeckView deckView
          The view of the deck
static int flipCard
           
protected  Pile[] foundation
          And four Piles as foundation.
protected  PileView[] foundationViews
          The home locations
protected  BuildablePile fromColumnView
          When a Card is being dragged, this object references points to the originating ColumnView.
protected  BuildablePileView fromPile
          Each Game may have cards dragged from BuildablePiles.
protected  PileView fromWaste
          Each Game may have cards dragged from the WastePile.
static int moveCardToFoundation
           
static int moveStack
           
static int moveWasteToFoundation
           
protected  IntegerView numLeftView
          View for the number of cards left in the deck.
protected  BuildablePile[] piles
          And seven BuildablePiles.
protected  BuildablePileView[] pileViews
          The columns
protected  IntegerView scoreView
          The display for the score.
protected  java.lang.String version
          Latest version.
protected  Pile wastePile
          And a waste pile.
protected  PileView wastePileView
          The display for the wastePile.
 
Constructor Summary
Klondike()
          Klondike constructor comment.
 
Method Summary
 java.util.Enumeration availableMoves()
          Return list of available moves.
 java.lang.String getName()
          getName method comment.
 java.lang.String getVersion()
          getName method comment.
 boolean hasWon()
          Return whether the game has been won.
 void initialize()
          initialize method comment.
protected  void initializeControllers()
          initialize controllers comment.
protected  void initializeModel(int seed)
          initialize method comment.
protected  void initializeView()
          initialize view comment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

deck

protected Deck deck
Each Game has a Deck.


fromPile

protected BuildablePileView fromPile
Each Game may have cards dragged from BuildablePiles.


fromWaste

protected PileView fromWaste
Each Game may have cards dragged from the WastePile.


piles

protected BuildablePile[] piles
And seven BuildablePiles. Extra size is to enable easier algorithms.


foundation

protected Pile[] foundation
And four Piles as foundation. Extra size is to enable easier algorithms.


version

protected java.lang.String version
Latest version.


wastePile

protected Pile wastePile
And a waste pile.


deckView

protected DeckView deckView
The view of the deck


pileViews

protected BuildablePileView[] pileViews
The columns


foundationViews

protected PileView[] foundationViews
The home locations


scoreView

protected IntegerView scoreView
The display for the score.


wastePileView

protected PileView wastePileView
The display for the wastePile.


numLeftView

protected IntegerView numLeftView
View for the number of cards left in the deck.


fromColumnView

protected BuildablePile fromColumnView
When a Card is being dragged, this object references points to the originating ColumnView.


dealCard

public static final int dealCard
Move Types.

See Also:
Constant Field Values

moveCardToFoundation

public static final int moveCardToFoundation
See Also:
Constant Field Values

moveWasteToFoundation

public static final int moveWasteToFoundation
See Also:
Constant Field Values

moveStack

public static final int moveStack
See Also:
Constant Field Values

flipCard

public static final int flipCard
See Also:
Constant Field Values
Constructor Detail

Klondike

public Klondike()
Klondike constructor comment.

Method Detail

availableMoves

public java.util.Enumeration availableMoves()
Return list of available moves.

Returns:
java.util.Enumeration

getName

public java.lang.String getName()
getName method comment.


getVersion

public java.lang.String getVersion()
getName method comment.


hasWon

public boolean hasWon()
Return whether the game has been won.

In Klondike, the game is won once the score reaches 52, which means that all thirteen cards of each of the four suits has made it to the foundation.

Returns:
boolean

initialize

public void initialize()
initialize method comment.


initializeControllers

protected void initializeControllers()
initialize controllers comment.


initializeModel

protected void initializeModel(int seed)
initialize method comment.


initializeView

protected void initializeView()
initialize view comment.