Optional Contest 1: Hog Strategy
A strategy is
A single function that makes
Ten thousand choices.
Table of Contents
This contest is completely optional!
hog.py file containing a function called
final_strategy and a name
final_bid bound to a non-negative integer.
python3 ok --submit
hog.py file and simple tests for correct formatting can be downloaded
as a zip archive. Type
python3 ok to run the provided tests.
Each submitted strategy will play against all other submissions. 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.
final_bid of each player will determine who plays first and the starting
scores of each player. The following three rules apply:
- If the bids are equal, each player starts with goal points, resulting in an
instant tie. It does not matter who rolls first.
- If one bid is exactly 3 higher than the other, the higher bidder rolls first
starting with 10 points, and the other player starts with 0. For example, if
player 0 bids 2 and player 1 bids 5, player 1 would roll first starting with
10 points and player 0 would start with 0 points.
- Otherwise, the player with the higher bid rolls first. Each player starts
with a number of points equal to her/his opponent's bid. For example, if
player 0 bids 3 and player 1 bids 4, player 1 would roll first starting with
3 points and player 0 would start with 4 points.
A submission scores a match point each time it has an expected win rate above
50.00000001% (.5 + 1e-10). The submissions with the most match points win.
- The contest may be entered individually or in pairs. Two people submit a
single entry. Each person in the course can only be associated with at most
- 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 be disqualified.
- Calling your
final_strategy function on every possible pair of scores
should take less than 2 minutes. Less than 5 seconds is strongly preferred.
- Winning entries will receive 2 points of extra credit.
- Winners will also be recognized publicly in future offerings of CS 61A.