You may work with one other person from the class on this assignment. You may NOT work with the same person you worked with on HW 1.
For many years, official ping pong (table tennis) games were played to 21 points. That is, a game continued until one player scored 21 points and led by at least two points. A match was typically two-out-of-three games. In 2001, the International Table Tennis Federation changed the scoring rules, moving to 11-point games and matches of three-out-of-five games (or sometimes four-out-of-seven). Their stated intent was to make games more exciting and also more TV friendly. For this assignment, you will develop functions for simulating ping pong games and matches, and collect statistics to help determine the effect of the scoring rules change.
Assume that the two players in a ping pong game are each assigned a skill level from 0 to 10. The higher the skill level, the more likely that player is to win a particular point. For example, if player 1 and player 2 have identical skill levels, say 6.5 and 6.5, each is equally likely to win a given point. However, if player 1 has a skill level of 6.5 and player 2 has a skill level of 3.25, then player 1 is twice as likely to win a given point. The following Python function can be used to simulate a single point in a ping pong game.
Note that a team has to win a game by at least two points. You will need to think carefully how to address this in your function.
score1
and score2
stored the player scores, the following would return a pair containing those scores: return (score1, score2)
.
It is possible to assign a pair in a single assignment, effectively assigning two variables at once. For example:
While the skill levels of the players determine the likelihood of winning a particular point, this is not the same as the likelihood of winning a game. In fact a small advantage in skill level can translate into a huge advantage in game winning percentage. For example, a player who is only 10% better than her opponent (say skill level 6.6 vs. 6.0) is ~25% more likely to win a game to 21. Consider the following hypothesis:
HYPOTHESIS 1: Reducing the length of games from 21 points to 11 points favors the weaker player, since a shorter lucky streak is required to steal a game from the stronger player.
You are to develop code and perform experiments to either support or refute this hypothesis.
gameStats
function working, generate data to fill in the table below. Each simulation should run 10,000 games.
player1 / player2 skill levels | likelihood of player 1 winning each point | % of 21-point games won by player 1 | % of 11-point games won by player 1 |
---|---|---|---|
5.0 / 5.0 | 50.0% | ||
5.5 / 4.5 | 55.0% | ||
7.5 / 5.0 | 60.0% | ||
8.0 / 4.0 | 66.7% | ||
6.0 / 2.0 | 75.0% | ||
8.0 / 2.0 | 80.0% | ||
9.0 / 1.0 | 90.0% |
Describe any trends you see in the game winning percentages. Does your data support or refute HYPOTHESIS 1? Explain.
In conjunction with shortening games, the new scoring system lengthened matches, going from two-out-of-three to three-out-of-five games. Consider the following hypothesis:
HYPOTHESIS 2: Increasing the length of matches from two-out-of-three to three-out-of-five games favors the stronger player, since more games makes it more likely that skill will win out over luck.
You are to develop code and perform experiments to either support or refute this hypothesis.
Note: this function should be very similar to pingPongGame
.
Note: this function should be very similar to gameStats
.
matchStats
function working, generate data to fill in the table below. Each simulation should run 10,000 matches, with games to 11 points.
player1 / player2 skill levels | likelihood of player 1 winning each point | % of 2-out-of-3 matches won by player 1 | % of 3-out-of-5 matches won by player 1 |
---|---|---|---|
5.0 / 5.0 | 50.0% | ||
5.5 / 4.5 | 55.0% | ||
7.5 / 5.0 | 60.0% | ||
8.0 / 4.0 | 66.7% | ||
6.0 / 2.0 | 75.0% | ||
8.0 / 2.0 | 80.0% | ||
9.0 / 1.0 | 90.0% |
Describe any trends you see in the game winning percentages. Does your data support or refute HYPOTHESIS 2? Explain.
The ITTF publicly stated that the motivation for the scoring change was to add excitement and make the sport more TV friendly. In particular, the changes were not intended to significantly change the balance of games. So, if a player had a certain likelihood of winning a match under the old rules, the likelihood of winning under the new rules should be comparable.
HYPOTHESIS 3: Shortening games from 21 to 11 points while simultaneously lengthening matches from two-out-of-three to three-out-of-five does not significantly change the likelihood of players winning or losing.
player1 / player2 skill levels | likelihood of player 1 winning each point | % of (21 pt, 2-of-3) matches won by player 1 | % of (11 pt, 3-of-5) matches won by player 1 |
---|---|---|---|
5.0 / 5.0 | 50.0% | ||
5.5 / 4.5 | 55.0% | ||
7.5 / 5.0 | 60.0% | ||
8.0 / 4.0 | 66.7% | ||
6.0 / 2.0 | 75.0% | ||
8.0 / 2.0 | 80.0% | ||
9.0 / 1.0 | 90.0% |
Describe any trends you see in the game winning percentages. Does your data support or refute HYPOTHESIS 3? If the winning percentages are not comparable, would going to four-out-of-seven games (to 11 points) be better? Explain.