Optional: Problem 12 (0pts)
Implement final_strategy
, which combines these ideas and any other ideas you have to achieve a high win rate against the baseline strategy.
Some suggestions:
picky_piggy_strategy
orswine_swap_strategy
are default strategies you can start with.- If you know the goal score (by default it is 100), there's no point in scoring more than the goal. Check whether you can win by rolling 0, 1 or 2 dice. If you are in the lead, you might decide to take fewer risks.
- Choose the
num_rolls
andcutoff
arguments carefully. - Take the action that is most likely to win the game.
You can check that your final strategy is valid by running ok
.
$ python ok -q 12
You can also play against your final strategy with the graphical user interface:
$ python hog_gui.py
The GUI will alternate which player is controlled by you.