public class FreecellGame
extends java.lang.Object
Cells: 1: 2: 3: 4: Kh Foundations: 5: AC, 2C, 3C, 4C 6: Ah, 2h, 3h, 4h, 5h, 6h, 7h 7: AS 8: Ad Cascades: 9: 6S, 7S, 5C, 2S, 8d, 6d, Jh, 10C, 9h, 8C, 7d, 6C 10: 7C 11: 4S, 3d 12: 13: QC, 8h, 9C, KC, Qd, JS, 10d, 9S 14: Kd, QS, Jd, 10S, 9d 15: 10h, 5d, 2d, 8S, JC, 5S, 4d, 3S 16: KS, Qh
Constructor and Description |
---|
FreecellGame(long seed)
Create a Freecell game with a random deal generated with a given seed.
|
Modifier and Type | Method and Description |
---|---|
Card[] |
getStack(int stackNum)
Return an array with the Card in the given stack number listed from bottom to top.
|
boolean |
isGameOver()
Return whether or not the game has been won (that is, all cards are on foundations).
|
boolean |
play(int srcStackNum,
int destStackNum)
Attempt to move a card from stack srcStackNum to stack destStackNum.
|
java.lang.String |
toString() |
public FreecellGame(long seed)
seed
- seed for random dealpublic boolean play(int srcStackNum, int destStackNum) throws IllegalPlayException
srcStackNum
- source stack numberdestStackNum
- destination stack numberIllegalPlayException
- thrown if (1) "Illegal stack number. Stacks are numbered 1-16.", (2) "Source and destination stacks must be different.", or (3) playTo(CardStack) throws one.public Card[] getStack(int stackNum)
stackNum
- stack numberpublic boolean isGameOver()
public java.lang.String toString()
toString
in class java.lang.Object