# Optional Contest: Hog Strategy

A strategy is

A single function that makes

Ten thousand choices.

## Contest Results

### Statistics

**77**contestants**21**new challengers on the last day**12**new challengers in the last 6 hours**4**first place winners

### Winners

- Edgar Orendain
- Going Deep Blue
- The best team on the 3rd floor of Davidson (U2)
- Going DeepMind

## Final Ranking

Last updated on Thursday, 07/07 at 09:44 PM

Rank |
Team |
Wins |
Losses |
Ties |
---|---|---|---|---|

1 | Edgar Orendain | 73 | 0 | 3 |

1 | Going DeepMind | 73 | 0 | 3 |

1 | The best team on the 3rd floor of Davidson (U2) | 73 | 0 | 3 |

1 | Going Deep Blue | 73 | 0 | 3 |

5 | gci | 72 | 4 | 0 |

6 | SuperNETi: Ressurected | 71 | 5 | 0 |

7 | Wonky Python and the Horrific Fail | 70 | 6 | 0 |

8 | Roadhog's Whole Hog | 68 | 8 | 0 |

8 | AJ | 68 | 8 | 0 |

10 | BSVK | 67 | 9 | 0 |

11 | Swap to Win | 66 | 10 | 0 |

12 | Pure Lambdas | 65 | 11 | 0 |

13 | Z | 64 | 12 | 0 |

14 | Thomas2 | 62 | 14 | 0 |

15 | ThomasSquared | 61 | 15 | 0 |

16 | k^2 | 60 | 16 | 0 |

17 | JL | 59 | 17 | 0 |

18 | CalSO Lunch Stealers | 58 | 18 | 0 |

19 | Sidd and Stella | 55 | 21 | 0 |

19 | Kwarrior | 55 | 21 | 0 |

21 | The best team on the 9th floor of Davidson (U2) | 54 | 22 | 0 |

22 | None | 52 | 24 | 0 |

23 | NSVR | 51 | 25 | 0 |

23 | abc | 51 | 25 | 0 |

25 | pigvicky | 50 | 26 | 0 |

26 | Better Than You | 49 | 27 | 0 |

26 | asdf | 49 | 27 | 0 |

28 | HELLO WORLD | 48 | 28 | 0 |

29 | cs61a-p | 46 | 30 | 0 |

29 | The Knight | 46 | 30 | 0 |

29 | Lobsta-Man | 46 | 30 | 0 |

32 | Anonymous | 45 | 31 | 0 |

33 | boostedanimal | 42 | 34 | 0 |

33 | MSI | 42 | 34 | 0 |

35 | GO | 39 | 37 | 0 |

35 | BurNing | 39 | 37 | 0 |

37 | Fabulous Tornado | 38 | 38 | 0 |

37 | EJ & AS | 38 | 38 | 0 |

39 | test | 37 | 39 | 0 |

39 | Jenny Wong | 37 | 39 | 0 |

39 | LoveLive! | 37 | 39 | 0 |

39 | make a big news! | 37 | 39 | 0 |

43 | The best couch on the ground floor study lounge of Davidson (U2) ;) ;) | 36 | 40 | 0 |

44 | Emily and William | 35 | 41 | 0 |

44 | Short Circuits | 35 | 41 | 0 |

46 | Dorma | 34 | 42 | 0 |

47 | Will and Sids Excellent Adventure | 32 | 44 | 0 |

48 | Legend | 29 | 47 | 0 |

48 | Leo&Steven | 29 | 47 | 0 |

48 | LambdaHog | 29 | 47 | 0 |

51 | invincible | 28 | 48 | 0 |

52 | Gucci Mane, Lord of the Trap | 26 | 50 | 0 |

53 | BERKOP | 25 | 51 | 0 |

54 | sour_kimch | 24 | 52 | 0 |

54 | Shirley | 24 | 52 | 0 |

56 | BERKOP | 23 | 53 | 0 |

56 | P | 23 | 53 | 0 |

58 | JC dy/dx | 22 | 54 | 0 |

59 | fubar | 17 | 59 | 0 |

59 | ZTH&HYQ | 17 | 59 | 0 |

61 | Zhen Duan | 16 | 60 | 0 |

61 | Ghost of Caesar | 16 | 60 | 0 |

63 | Who runs the world—us | 14 | 62 | 0 |

64 | Pepe | 13 | 63 | 0 |

64 | William Qichao Wang | 13 | 63 | 0 |

66 | whatever | 12 | 64 | 0 |

66 | hog.py | 12 | 64 | 0 |

68 | NeverTooLate | 11 | 65 | 0 |

69 | Pied Piper | 9 | 67 | 0 |

70 | R | 8 | 68 | 0 |

71 | cs61a-kj | 7 | 69 | 0 |

72 | Jemin | 5 | 71 | 0 |

73 | cs61a-np | 4 | 72 | 0 |

74 | cs61a-ef | 1 | 73 | 2 |

74 | cs61a-gk,cs61a-cq | 1 | 73 | 2 |

74 | cs61a-am | 1 | 73 | 2 |

77 | The best team on the basement floor of Davidson (U2) | 0 | 76 | 0 |

## Instructions

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
`TEAM_NAME`

.

`python3 ok --submit`

## Contest rules

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

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

Some additional rules:

- The contest may be entered individually or in pairs. Two people submit a single entry (make sure you register each other as partners on okpy.org). Each person in the course can only be associated with at most one entry.
- 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 10 seconds. The provided tests check for this.

## Game rules

The contest will use the same rules from Project 1:

**Pig Out**. If any of the dice outcomes is a 1, the current player's score for the turn is 1.**Free Bacon**. A player who chooses to roll zero dice scores one more than the largest digit in the opponent's total score.**Hogtimus Prime**. If a player's score for the turn is a prime number, then the turn score is increased to the next larger prime number. For example, if the dice outcomes sum to 19, the current player scores 23 points for the turn. This boost only applies to the current player.*Note:*1 is not a prime number!**Hog Wild**. If the sum of both players' total scores is a multiple of seven (e.g., 14, 21, 35), then the current player rolls four-sided dice instead of the usual six-sided dice.**Hog Tied**. If the sum of both players' scores ends in a seven (e.g., 17, 27, 57), then the current player can roll at most one dice.**Swine Swap**. After the turn score is added, if the current player's total score contains only one unique digit, the players swap total scores.