All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tsadam.bowling.BowlingScore

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

public class BowlingScore
extends Object
implements Cloneable
Keeps the bowling score for one line (one game by one player).


Constructor Index

 o BowlingScore()
Constructs a new bowling score line.

Method Index

 o clone()
Returns a copy of the bowling score line.
 o getBallMark(int)
Gets the mark for the game ball.
 o getBallPinFall(int)
Gets the pinfall for the game ball.
 o getFirstBall(int)
Gets the pinfall for the first ball of a frame if it was not a strike.
 o getFrameBall()
Gets the current ball of the current frame.
 o getFrameNum()
Gets current frame number.
 o getFrameScore(int)
Gets the score at a frame.
 o getGameBall()
Gets the current game ball.
 o getMark(int)
Gets the mark of a frame.
 o init()
Initializes the bowling score line.
 o scoreBall(int)
Scores a thrown ball.
 o scoreBallWithFramePinfall(int)
Scores a thrown ball.

Constructors

 o BowlingScore
 public BowlingScore()
Constructs a new bowling score line.

Methods

 o clone
 public Object clone()
Returns a copy of the bowling score line.

Overrides:
clone in class Object
 o getBallMark
 public char getBallMark(int b)
Gets the mark for the game ball.

Parameters:
b - the number of the game ball, numbered from 0 (0 = 1st ball thrown in the game, 20 = 21st ball thrown in the game).
Returns:
' ' = no mark - the ball was not the final ball of the frame; '-' = the ball missed (did not make the spare); '/' = the ball made a spare; 'x' = the ball made a strike
 o getBallPinFall
 public int getBallPinFall(int b)
Gets the pinfall for the game ball.

Parameters:
b - the number of the game ball, numbered from 0 (0 = 1st ball thrown in the game, 20 = 21st ball thrown in the game).
Returns:
Number of pins knocked down with the ball. -1 = the ball has not yet been thrown.
 o getFirstBall
 public int getFirstBall(int f)
Gets the pinfall for the first ball of a frame if it was not a strike.

Parameters:
f - frame, 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).
Returns:
Pinfall; -1 = frame not yet played or strike.
 o getFrameBall
 public int getFrameBall()
Gets the current ball of the current frame. Considers balls thrown to fill a mark in the 10th frame as separate frames.

Returns:
1 = first ball; 2 = second ball
 o getFrameNum
 public int getFrameNum()
Gets current frame number.

Returns:
frame, 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).
 o getFrameScore
 public int getFrameScore(int f)
Gets the score at a frame.

Parameters:
f - frame, numbered from 0 (0 = 1st frame).
Returns:
cumulative score at the frame. -1 = not played, or not able to tally (a mark is pending).
 o getGameBall
 public int getGameBall()
Gets the current game ball.

Returns:
game ball, numbered from 0 (0 = 1st ball of game, 20 = 21st ball thrown in the game).
 o getMark
 public char getMark(int f)
Gets the mark of a frame.

Parameters:
f - frame, numbered from 0 (0 = 1st frame).
Returns:
' ' = frame not yet played; '-' = miss; '/' = spare; 'x' = strike.
 o init
 public void init()
Initializes the bowling score line. Can be used to start a new game using the same bowling score object.

 o scoreBall
 public int scoreBall(int pf)
Scores a thrown ball.

Parameters:
pf - the pinfall for the ball.
Returns:
current frame (after ball is scored) 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 scoreBallWithFramePinfall
 public int scoreBallWithFramePinfall(int fpf)
Scores a thrown ball.

Parameters:
fpf - the total pinfall in the frame after the ball has been thrown. For example, if the first ball has just been thrown and takes 5 pins, fpf = 5; if the second ball has just been thrown and takes 3 pins after the first ball had taken 6 pins, fpf = 9.
Returns:
current frame (after ball is scored) 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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index