Skip to main content

Week 8 Tutorial: Break the game

Write the laziest, strangest and most cowardly simulated players you can, and find out whether any of them beats playing properly.

29 April 2027

Before the tutorial

Think of the most annoying person you have ever played a game with. Bring their habits.

In the tutorial

Corner camping. Circling the edge. Never picking up anything. Only ever moving left. Each one is five lines of code. Run all of them, 51 seeds each, against the intended strategy’s 101.6 s and 12 wins.

If something beats it, you have found a bug in the design and not in the code. Change one constant, run everything again, and check you have not made a different lazy player the new winner.

Where it goes wrong

What a finished answer looks like

Intended: 101.6 s, 12 of 51. Run away: 52.5 s, 1 of 51. Circle the edge: 44.8 s, 0 of 51. Camp a corner: 18.6 s, 0 of 51. Nothing lazy comes within 49 s of playing properly, so I am changing no constant.

Afterwards

The strategy table is this week’s quiz answer. Weeks 6 to 8 end here; weeks 9 and 10 are about what none of these tables can tell you.

The spec

What you walk out with. Every line is something the person sitting next to you could check.

Teaching team