A strategy is
A single function that makes
Ten thousand choices.
This contest is completely optional!
Download a blank
final_strategy.py file and simple tests for correct
formatting as a zip archive. Type
python3 ok to run the provided tests.
final_strategy.py file containing a function called
python3 ok --submit
The contest ends on Thursday, July 8 at 11:59 PM. We will use your latest submission before this date to determine the final results of the contest.
You can use the
compare_strategies.py file to compute the exact win rate
between any pair of two strategies using our server. Depending on server load,
we may rate-limit or disable this functionality at any point, so consider
re-implementing this file yourself locally!
Your strategy can run as long as you want. If
ok complains that you're
exceeding the time limit, run it with the flag
--timeout 0 to disable the time
Teams can have one or two people. Each person can only be part of one team.
Each submitted strategy will play against all other submissions. The player to go first will be determined by a flip of a fair coin. We will exactly compute the expected win rate for each player, so that the outcome of this tournament will be determined by strategy alone and not the roll of the dice or flip of a coin. A submission scores a match point each time it has an expected win rate strictly above 50.0001%. We will rank submissions based on the number of matches they won. Ties count as losses.
The top three submissions will earn the following:
- First place gets 3 points of extra credit.
- Second place gets 2 points of extra credit.
- Third place gets 1 point of extra credit.
Winners will also be publicly recognized in future iterations of 61A.
To make things more interesting, we've introduced a new rule (Time Trot) in addition to the original set of special rules. Here are the full set of rules:
- Sow Sad. If any of the dice outcomes is a 1, the current player's score for the turn is 1.
- Example 1: The current player rolls 7 dice, 5 of which are 1's. They score 1 point for the turn.
- Example 2: The current player rolls 4 dice, all of which are 3's. Since Sow Sad did not occur, they score 12 points for the turn.
- Piggy Points. A player who chooses to roll zero dice scores
k + 4points, where
kis the absolute value of the tens digit minus the ones digit in the opponent's score. If the opponent's score is only one digit, assume the tens digit is 0. You may not assume that the score is under
- Example 1: The current player rolls zero dice and the opponent has a score of 14.
|1 - 4| = 3, so the current player will receive
3 + 4 = 7points.
- Example 2: The current player rolls zero dice and the opponent has a score of 50.
|5 - 0| = 5, so the current player will receive
5 + 4 = 9points.
- Example 3: The current player rolls zero dice and the opponent has a score of 9.
|0 - 9| = 9, so the current player will receive
9 + 4 = 13points.
- Example 4: The current player rolls zero dice and the opponent has a score of 156.
|5 - 6| = 1, so the current player will receive
1 + 4 = 5points.
- More Boar. After the points for the turn are added to the current player’s score, the current player takes an extra turn if the minimum digit of the current player's score is strictly smaller than the minimum digit of the opponent's score and the maximum digit of the current player's score is strictly larger than the maximum digit of the opponent's score. You may not assume that the scores are under
100. The More Boar calculation should be done on the current player's score after the points from the current turn are added. More Boar can be activated multiple times in a row for the same player (see Example 4).
- Example 1: After the points are added, the current player has a score of 25 and the opponent has a score of 43.
2 < 3, and
5 > 4, the current player takes an extra turn.
- Example 2: After the points are added, the current player has a score of 32 and the opponent has a score of 33.
Since the current player's maximum digit (3) is not strictly larger than the opponent's maximum digit (
3 = 3), the current player does not take an extra turn.
- Example 3: After the points are added, the current player has a score of 7 and the opponent has a score of 10.
Since the current player's score only has one digit,
7is both the maximum and minimum digit of the current player's score, and 0 is the minimum digit of the opponent’s score. Since
7 >= 0, the current player does not take an extra turn.
- Example 4: After the points are added, the current player has a score of 25 and the opponent has a score of 43. Like in Example 1, the current player takes an extra turn. If the current player then rolls a 1 and now has a score of 26, More Boar activates again and the current player takes yet another extra turn.
- Time Trot. A turn involves a player rolling dice, and each turn is numbered, starting from 0. If a player chooses to roll a number of dice
n % 8 == k, then that player gets an extra turn immediately after the current turn. However, a player cannot get an extra turn as a consequence of Time Trot immediately after an extra turn, though they can get an extra turn as a consequence of More Boar. Furthermore, players will roll 8-sided dice on all extra turns (including those produced from More Boar).
- All strategies must be deterministic, pure functions of the current player scores. Non-deterministic strategies or strategies based on the history of the game will not behave as expected when submitted and will likely not do well.
- You may use any libraries (such as NumPy, TensorFlow, or anything else you can think of) in your submission.
If you have any questions about the rules, don't hesitate to post on Piazza.