|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object proj3.Game
public class Game
This class provides all methods used by the GUI for Monte Carlo Solitaire. Class Invariant: to be supplied by the student.
Constructor Summary | |
---|---|
Game(int tableauRows,
int tableauColumns)
Construct a new Monte Carlo Solitaire object |
Method Summary | |
---|---|
void |
consolidate()
Moves cards in the tableau towards the top (left and up) to replace the cards that were removed. |
java.lang.String |
getHelpText()
Returns a help message explaining the rules of the game. |
Coordinate[] |
getHint()
Finds two matching cards according to the rules of the game (NOTE: this method should only be called if isHintImplemented() returns true |
Rank |
getRank(Coordinate coordinates)
Returns a Rank enum representing the rank of the card at the specified coordinate in the tableau |
int |
getScore()
Returns the player's score for the current game |
Suit |
getSuit(Coordinate coordinate)
Returns a Suit enum representing the suit of the card at the specified coordinate in the tableau |
boolean |
isHintImplemented()
Indicates that the EXTRA CREDIT hint feature ( getHint() ) was implemented. |
boolean |
isWin()
Determines if the player has won the game by removing all the cards and thereby achieving a score of 52 |
void |
newGame(long gameNumber)
Starts a new game of solitaire for the specified game number in accordance to project specifications. |
int |
numberOfCardsLeft()
Returns the number of cards left in the deck |
boolean |
removeCards(Coordinate coordinate1,
Coordinate coordinate2)
Determines if the cards at the specified tableau locations are a match according to the rules of Monte Carlo Solitaire and if so, removes them from the tableau |
void |
replay()
Restarts the current game |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Game(int tableauRows, int tableauColumns)
tableauRows
- the number of rows in the tableautableauColumns
- the number of columns in the tableauMethod Detail |
---|
public void newGame(long gameNumber)
gameNumber
- the game number to playpublic int numberOfCardsLeft()
public int getScore()
public Suit getSuit(Coordinate coordinate)
Suit
enum representing the suit of the card at the specified coordinate in the tableau
coordinate
- the coordinate of the card in question
Suit
of the cardpublic Rank getRank(Coordinate coordinates)
Rank
enum representing the rank of the card at the specified coordinate in the tableau
coordinates
- the coordinate of the card in questions
Rank
of the cardpublic java.lang.String getHelpText()
public void replay()
public void consolidate()
public boolean isHintImplemented()
getHint()
) was implemented.
true
if the hint feature is functional, false
otherwisegetHint()
public Coordinate[] getHint()
isHintImplemented()
returns true
Coordinates
for the matching cards if found, null
if no match is
foundisHintImplemented()
public boolean removeCards(Coordinate coordinate1, Coordinate coordinate2)
coordinate1
- the coordinate of the first cardcoordinate2
- the coordinate of the second card
true
if cards can be removed, false
otherwisepublic boolean isWin()
true
if the player has won, false
otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |