From 37991656b9c3bbcb39041254b1d0382455dd8b91 Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Wed, 14 Jul 2021 22:05:03 -0700 Subject: [PATCH] make use of prettier dislpays --- README.md | 1 + config.nims | 5 +++++ cup.nim | 11 +++++------ 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 config.nims diff --git a/README.md b/README.md index bda5dc8..7400c60 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This tool calculates probable outcomes for the board game CamelUp. It can calculate all possible outcomes for a single game leg in about 5ms, so effectively instantaneously. Full-game calculations take a little bit longer and are not exact (since it isn't practical to simulate all possible full game states.) However it can easily simulate a million random games in about 80ms in the worst case, which should provide estimates accurate to within about 0.2%. +(Numbers from running on a Ryzen 3700X.) ``` Usage: diff --git a/config.nims b/config.nims new file mode 100644 index 0000000..c3b9fc0 --- /dev/null +++ b/config.nims @@ -0,0 +1,5 @@ +--threads: on +--d: release +--opt: speed +--passC: -flto +--passL: -flto \ No newline at end of file diff --git a/cup.nim b/cup.nim index 38f0bf6..09d2678 100644 --- a/cup.nim +++ b/cup.nim @@ -1,5 +1,4 @@ -import math, options, sequtils, random, sets -import combinators, game, fixedseq, simulation, ui +import game, simulation, ui when isMainModule: @@ -8,11 +7,11 @@ when isMainModule: b.init b.setState(config.state, []) b.diceRolled = config.diceRolled - b.display(1, 5) + echo b.showSpaces(1, 16) let legScores = b.getLegScores - echo "Current leg probabilities:" - legScores.display + echo "\nCurrent leg probabilities:" + echo legScores.showPercents() let gameScores = b.randomGames(1_000_000) echo "\nFull game probabilities (1M simulations):" - gameScores.display + echo gameScores.showPercents()