Optional Contest: Hog Strategy
A strategy is
A single function that makes
Ten thousand choices.
Instructions
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.
Submit a final_strategy.py
file to Pensieve.
The contest ends on Thursday, September 25 at 11:59 PM. We will use your latest submission before this date to determine the final results of the contest.
Your strategy should not take more than about 5 minutes to run on a single-threaded machine with about 8GB of RAM. Specifically, the following loop should take no more than about 5 minutes:
for i in range(300):
for j in range(300):
final_strategy(i, j)
Strategies that take significantly longer to run (such as 10+ minutes) or require special hardware (e.g. GPUs) to run fast will be disqualified.
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 strictly above 50.0001%. We will rank submissions based on the number of matches they won. Ties count as losses.
The top submission gets 2 points of extra credit!
The next nine submissions get 1 point of extra credit.
Don't use AI. This contest, which is just for fun, is about human ingenuity. You may not use language models (ChatGPT, etc.) to generate any code related to this project, either for your final submission or during development. You may not use language models to suggest an approach. Try to come up with a solution yourself.
Of course you can talk to other students and read articles online, but if there is some indication that some top-scoring submissions weren't created entirely by the participants but instead using a language model or by copying code found online, then all extra credit points for the contest will be cancelled. (Please try not to ruin the contest for yourself or others.)
To discourage you from just hard-coding your program output in your submission, we have introduced a size penalty for large submissions. Specifically, your goal
will not simply be 100
, but will instead depend on the size of the final_strategy.py
file that you submit, according to the following function:
def target_score(program_size_in_bytes):
scaled_score = program_size_in_bytes / 10000 * 300
return int(min(max(scaled_score, 50), 300))
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.
Your final_strategy.py
cannot depend on any external modules. Use the Python
standard library. You are welcome to use external modules during development,
but not in your final submission.
Happy coding!