您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
Noëlle 65e0fcf9b2
More formatting
2 年前
README.md More formatting 2 年前
potato_game.py Simulator complete 2 年前

README.md

Simulator for Potato, a one-page RPG

See https://twitter.com/deathbybadger/status/1567425842526945280 for details.

Potato is a single-player, one-page RPG where you play as a halfling, farming and harvesting potatoes while the Dark Lord amasses his forces elsewhere in the world.

You have three scores: DESTINY, POTATOES, and ORCS. Each round, you roll d6 to determine which type of event you experience: a day in the garden, a knock at the door, or a darkening of the world.

For the first two, you then roll a second d6 to determine how your scores change; the third event makes it cost more potatoes to get rid of orcs. (At the beginning of the game, you can spend 1 potato to reduce your ORCS score by 1.) If any score reaches 10, the game ends with that score’s ending; if DESTINY and ORCS reach 10 in the same round, ORCS wins, and if DESTINY and POTATOES reach 10 in the same round, you get a multi-win. (ORCS and POTATOES can never reach 10 in the same round.)

When the simulator has simulated the requested number of games, it will report its results: the number and percentage of wins for each score type, and the mean and median number of rounds it took to win a game.

How to run it

The simulator requires Python 3.6+, but it doesn’t need any third-party libraries. To run it, download potato_game.py, navigate to the directory you downloaded it to, and run python3 potato_game.py in the command line. This will run the simulator with the default settings: not verbose, not multiwin, no potato-spending algorithm, and 10,000 iterations.

To change the simulator’s behavior, you can use various option flags on the command line. You can use more than one option at once.

Game Options

-v, --verbose Print detailed information about each game. This gets very long; probably don’t use it if you’re asking for a large number of games!

-n, --numruns [N] The number of games to simulate. Default: 10000

-m, --multiwin Announce on the console when a game ends in a multi-win. This can lead to a lot of output.

-i, --instructions Print these instructions and exit without doing anything else.

Mutually Exclusive Options:

-a, --alt Use Wanderer’s algorithm for determining when to spend potatoes to reduce orcs. This spends a potato if ORCS could win this round and POTATOES could not, OR if ORCS is greater than one and a 1d10 comes up less than the ORCS score. It will only spend a potato if there are enough potatoes to spend.

-p, --potatoper [N] Use the Potato-Per algorithm for determining when to spend potatoes to reduce orcs. This spends a potato when the ratio of POTATOES to ORCS rises above a certain amount, modified by the POTATOES cost to reduce ORCS by 1. It will only spend a potato if there are enough potatoes to spend.