Coding practices-Tennis scoring

Source: Internet
Author: User

Tennis scoring
1) if the first player wins at least four points and at least two more matches than the opponent, the player wins a game ).
2) scoring in each game is measured in a unique way in the tennis world: 0, 1, 2, and 3 balls are scored at 0, 15, 30, and 40 respectively.
3) if each contestant has already won at least three balls with the same score, each player is called "Deuce )".
4) if each contestant has already won at least three matches and one of them wins one more than the other, the contestant is called "advanced )".

Origin
Tennis was a "jeude Paume" held at the court in the 14th century, originating in the French Louis dynasty (meaning "a game with palm hitting "). Later, the UK was introduced in the 19th century and its improvements were held on turf. Because the most primitive Tennis Sport originated from the court, it is understandable that the scoring method is based on the ground. They scored by the clock that can be switched. Every minute they got the clock turned 1/4, that is, 15 points (aquarter, a moment). Likewise, if you have two minutes, you can set the clock to 30 minutes. Of course, everything is based on their convenience. This is the origin of 15 points and 30 points. As for 40 points, it is odd. It is not a multiple of 15. This is because, in English, it is a dual-syllable, and a "Thirty" in 30 minutes. It is also a two-syllable. However, it is 45 minutes, the English pronunciation "forty-five" has changed to three syllables. At that time, the British thought it was a bit difficult and did not comply with the "convenience" principle, so we changed it to the same two-syllable 40 points (forty ). This is the logic of 40 points.

(Source: http://baike.baidu.com/view/556970.htm)

You task is to implement a tennis scoring program.
Summary of tennis scoring:

1. A game is won by the first player to have won at least four points in total and at least two points more than the opponent.

2. the running score of each game is described in a manner peculiar to tennis: scores from zero to three points are described as "love", "Fifteen", "Thirty ", and "Forty" respectively.

3. if at least three points have been scored by each player, and the scores are equal, the score is "Deuce ".

4. if at least three points have been scored by each side and a player has one more point than his opponent, the score of the game is "advantage" for the player in the lead.

[Source http://en.wikipedia.org/wiki/tennis?scoring]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.