All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tsadam.bowling.BowlingSolitaire

java.lang.Object
   |
   +----tsadam.bowling.BowlingSolitaire

public class BowlingSolitaire
extends Object
One game of Bowling Solitaire (by Sid Sackson). The game is for one player and one line (ten frames) of bowling.


Constructor Index

 o BowlingSolitaire()
Constructs a game of Bowling Solitaire.

Method Index

 o checkToPlayBallCard()
Checks to see if it is legal to play a ball card from the currently picked ball card pile.
 o checkToTogglePinPicked(int)
Checks if it is legal to toggle the picked status of a specific pin.
 o gameOver()
Checks to see if the game is over.
 o getNumFallenPins()
Gets the current number of fallen pins.
 o getNumPickedPins()
Gets number of pins currently picked.
 o getPlayedCards()
Gets the array of the ranks played cards.
 o init()
Initializes the game of Bowling Solitaire.
 o pickPile(int)
Picks a ball card pile.
 o pileEmpty(int)
Returns whether a specific ball card pile is empty.
 o playBallCard()
Plays the currently picked ball card.
 o setPinPicked(int)
Sets the specified pin's status to "picked".
 o throwBall()
Throws a ball.
 o togglePinPicked(int)
Toggles the picked status of the specified pin.

Constructors

 o BowlingSolitaire
 public BowlingSolitaire()
Constructs a game of Bowling Solitaire. The game contains a Bowling Score.

See Also:
BowlingScore

Methods

 o checkToPlayBallCard
 public boolean checkToPlayBallCard()
Checks to see if it is legal to play a ball card from the currently picked ball card pile. (Checks that all game rules are followed.)

Returns:
true = o.k. to play ball card; false = not o.k. to play ball card
 o checkToTogglePinPicked
 public boolean checkToTogglePinPicked(int p)
Checks if it is legal to toggle the picked status of a specific pin.

Parameters:
p - The pin to check, numbered from 0 (0 = head pin, 9 = ten pin).
Returns:
true = it's o.k. to toggle the picked status; false = it's not o.k. to toggle the picked status.
 o gameOver
 public boolean gameOver()
Checks to see if the game is over.

Returns:
true = game is over; false = game is not over.
 o getNumPickedPins
 public int getNumPickedPins()
Gets number of pins currently picked.

Returns:
Number of pins currently picked.
 o getNumFallenPins
 public int getNumFallenPins()
Gets the current number of fallen pins.

Returns:
number of fallen pins
 o getPlayedCards
 public int[] getPlayedCards()
Gets the array of the ranks played cards.

Returns:
array of the ranks of played cards, indexed 0 to 19. The ranks are in the lowest index positions, and the rest of the array is filled with -1. For example, if 17 cards have been played, the ranks will be in positions 0 through 16 and position 17 through 19 will contain -1.
 o init
 public void init()
Initializes the game of Bowling Solitaire. This is the "play again" method.

 o pickPile
 public boolean pickPile(int p)
Picks a ball card pile.

Parameters:
p - pile to pick, numbered from 0.
Returns:
true = pile successfully picked; false = pile not successfully picked.
 o pileEmpty
 public boolean pileEmpty(int p)
Returns whether a specific ball card pile is empty.

Parameters:
p - ball card pile, numbered from 0.
Returns:
true = pile is empty; false = pile is not empty.
 o playBallCard
 public boolean playBallCard()
Plays the currently picked ball card. Checks first that it is legal to play the ball card.

Returns:
true = ball card successfully played; false = ball card not successfuelly played.
See Also:
checkToPlayBallCard
 o setPinPicked
 public boolean setPinPicked(int p)
Sets the specified pin's status to "picked". First checks that it is legal to set the pin's status to "picked".

Parameters:
p - pin, numbered from 0 (0 = head pin, 9 = ten pin).
Returns:
true = pin's status succesfully set to "picked"; false = * true = pin's status not succesfully set to "picked".
 o throwBall
 public int throwBall()
Throws a ball.

Returns:
current frame after ball has been thrown, numbered from 0 (0 = 1st frame). We count the balls thrown to fill a 10th frame mark as separate frames (10 = "frame" for filling a mark in the 10th, 11 = "frame" for filling two strikes in the 10th). -1 = end of game.
 o togglePinPicked
 public boolean togglePinPicked(int p)
Toggles the picked status of the specified pin.

Parameters:
p - pin, numbered from 0 (0 = head pin, 9 = ten pin).
Returns:
true = pin's picked status successfully toggled. false = pin's picked status not successfully toggled.

All Packages  Class Hierarchy  This Package  Previous  Next  Index