How to calculate Bowling Score(保龄球计分算法)

  A game of ten-pin bowling is divided into ten rounds (called "frames"). In a frame, each player is given two opportunities to knock down the skittle targets (called "pins"). The player rolls the first ball at the pins. If the first ball knocks down all ten pins, it is called a strike and the frame is completed. When pins are left standing after the first ball, the player rolls a second ball and if all the remaining pins are knocked down, it is called a spare.
  You can get more info about ten-pin bowling, its rules of play and scoring from here

Next I will give u two methods to calculate score for a entire game:

  1. A strike wins you ten points plus the points for the next two balls thrown (for example if you got a strike then followed with a 7 then 2 your value for the strike would be 10+7+2, or 19). A spare wins you ten points plus the points for the next ball thrown (again, if you get a spare then follow it with 7 pins down your value for the spare would be 10+7, or 17). Open frames are added normally (example: you knock down 5 on your first ball and 3 on your second your open frame would be worth 5+3, or 8 points). The maximum score in tenpin bowling is 300. Below is the function to get score:

Get Score

  2. There does exist an alternative method for keeping score. It is used by scoreboards at some tournaments, and by some bowling software programs. It is exactly the same as the conventional scoring described above, except that the score is always current.

  The basic rules are as follows:

  • Spare = Points scored for the next ball are doubled (2 points per pin knocked down);
  • Strike = Points scored for the next two balls are doubled (2 points per pin);
  • Two or more strikes in a row = Points scored for the next ball are tripled (3 points per pin). If this roll is not a strike then the next ball is counted with doubled points.
  • If all ten pins are not knocked down, no bonuses are scored on subsequent throws - only actual pinfall.

  The scoring for the tenth frame goes as follows:

  • If a spare was earned in the ninth frame, score double on the first ball in the tenth frame and face value (single) for the second and third balls, if there is a third ball.
  • If a strike was earned in the ninth frame, score double on the first two balls in the tenth frame and single on the third ball.
  • If strikes were earned in the 8th and 9th frames (as in our sample), score triple on the first ball in the tenth, double on the second ball, and single on the third.
  • If the ninth frame was open (all 10 pins not down on 2 balls), then all three balls in the tenth count single.

  Below is the function to get score:

Get Score

 

Go to my home page for more posts

你可能感兴趣的:(core)