1K ZX81 Monopoly Sim

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
TheSnial
Posts: 8
Joined: Sun Apr 14, 2019 10:42 pm

1K ZX81 Monopoly Sim

Post by TheSnial »

Our family plays Monopoly every Boxing Day and the winner gets to keep our Monopoly trophy for a year with their name inscribed on a new lolly stick. Since I've never won, I wanted to simulate the game of monopoly to find out if I could improve my chances :-) . Naturally, it's not good enough just to simulate the game, the quest is whether it's possible to do that on a 1K ZX81! We can do that by some analysis on what really counts for the simulation.

In my analysis I didn't draw the board; store the names of the sites; maintain any money for site prices or rents; only each location's popularity is important. Without money, cards only redirect the player's position and Community Chest is just a subset of Chance. Finally, we get out of jail immediately, but I ignored going to Jail by rolling three doubles.

This means the simulation is pretty simple:
  • We need an array of 40 locations to hold popularities.
  • We need to simulate two dice for moving parts: the sum of two random numbers 1..6.
  • We need to redirect the locations if we land on one of the 3 Chance or 3 Community Chest locations or Goto Jail.
  • The redirect locations are: 0 (GO), 10 (Jail), 11 (Pall Mall), 15 (Marlebone stations), 24 (Trafalgar Square), 39 (Mayfair) or back 3 spaces, but Community Chest is limited to the first two.
  • We could calculate going to jail if the last 3 rolls are doubles and this would mean an extra jail visit every 1/216 throws on average. Getting out of jail by throwing a double wouldn't affect results because the throw only puts the player into the 'just visiting' location and thus doesn't affect where they land after leaving jail.
  • Periodically we should display the current popularities.
With all these rules apart from the even dice jail rule and using the normal ZX81 Basic space-saving rules we can squeeze the code into 1Kb.

Image
Image

It takes about 1 hour to run the simulation in slow mode, printing out an update every 84s. Running it in fast mode would take about 15 minutes and would stop when Just Visiting Jail had been hit 256 times (because the count is held as byte values in a string array).

You can find out more details and the amazing results (which I've excluded here for the thrill of the suspense) from my wondrous blog entry.. at: https://oneweekwonder.blogspot.com/2019 ... y-sim.html
MonopSim4.z80.zip
(1.2 KiB) Downloaded 264 times
Post Reply