编码操练招式——网球计分

来源:互联网 发布:制作课件的软件 编辑:程序博客网 时间:2024/04/30 07:49
网球计分
1)如果第一位选手总共赢了至少4个球(Point),并且至少比对手多赢2个球,那么这位选手就赢了一局(Game)。
2)每一局的计分用网球界特有的方式来统计:赢0、1、2、3个球,分别计0、15、30、40分。
3)如果每位选手都已经赢了至少3个球,且得分相同,那么每位选手就称为“平分(Deuce)”。
4)如果每位选手都已经赢了至少3个球,并且其中一位选手比对方多赢1球,那么该选手称为“领先(advantage)”。


15,30,40分的由来
网球是在十四世纪起源于法国路易斯王朝时代,在宫廷中举行的"jeude paume"(意为"用手掌击球的游戏")。后来在十九世纪引进英国,改良在草皮上举行。 因为最原始的网球运动是起源于宫廷之中,所以计分方法就地取材是可以理解的。他们拿可以拨动的时钟来计分,每得一次分就将时钟转动四分之一,也就是15分(aquarter,一刻),同理,得两次分就将时钟拨至30分,当然一切都是以他们的方便为基础。这就是15分、30分的由来。 至于40分,它比较怪异,它不是15的倍数。这是因为在英文中,15分念作"fifteen",为双音节,而30分念作"thirty",也是双音节;但是45分,英文念作"forty-five",变成了三个音节,当时着英国人觉得有点拗口,也不符合"方便"的原则,于是就把它改成同为双音节的40分(forty)。这就是看来不合逻辑的40分的由来。

(来源: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]


原创粉丝点击