Optional Contest: Hog Strategy

A strategy is
A single function that makes
Ten thousand choices.


This contest is completely optional!

Download a blank hog_contest.py file and simple tests for correct formatting as a zip archive. Type python3 ok to run the provided tests.

Submit a hog_contest.py file containing a function called final_strategy and a PLAYER_NAME.

python3 ok --submit

The contest ends on Monday, September 23rd at 11:59 PM. We will use your latest submission before this date to determine the final results of the contest.


The leaderboard can be found here.

Contest rules

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 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:

  1. First place gets 3 points of extra credit.
  2. Second place gets 2 points of extra credit.
  3. Third place gets 1 point of extra credit.

Winners will also be publicly recognized in future iterations of 61A!

Some additional contest rules:

  • Calling your final_strategy function on every possible pair of scores should take less than 10 seconds. The provided tests check for this.
  • 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.
  • You should only use built-in functions or functions from the Standard Python Library in your submission. You may use other libraries to compute information that will help you develop your final strategy.
  • Please don't do anything nefarious to learn about or influence other students' submissions.

If you have any questions about the rules, don't hesitate to post on Piazza.

Happy coding!