From 7d8c1bfc4b2a6f016c73efdbc1db249e212441fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 15 Dec 2019 01:04:17 +0100 Subject: [PATCH] update readme --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1ce1e2c..0b5b469 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,6 @@ or changed without updating this reference. Search for `SettingsStorage`. ``` { log: 'info', // default log level - allowTemplateAugmenting: false, // sloppy mode retryTemplate: 30, // retry attempts within one template attemptTemplates: 50, // number of templates to try on failure svgEffects: false, // fancy mode @@ -125,19 +124,20 @@ Algorithm Quirks Every board must be solvable, otherwise it wouldn't be much of a game. Generating a valid board turned out quite a bit more challenging than I thought. My algorithm is based in some heuristics -and good deal of luck. +and luck. To make things more fun, besides the marble matching rules, the board must be laid out in one of several pre-defined shapes of exactly 55 tiles. The algorithm can sometimes get itself into a dead -end while placing marbles on the board. I experimented with backtracking, but the current version -simply retries the whole thing with a different random seed. There are configurable retry limits -as a failsafe. If the given template fails many consecutive times, the algorithm opts to switch to +end while placing marbles on the board. After some experimentation I settled on a recursive algorithm +with a heuristic and backtracking. There are configurable retry limits and max recursion / retry +counter as a failsafe. If the given template fails many consecutive times, the algorithm opts to switch to a different template. Some templates are harder than others, and some random seeds just seem to have a problem. -A workaround I added is called Sloppy Mode. When the algorithm can't place a marble, it may choose -to add a new tile to the template, trying to keep the overall shape as tidy as possible. This may -hurt game difficulty, but is generally much faster than retrying over and over. +I added a few extra rules to the generation algorithm to make the boards harder: Vitae and Mors should not +appear as the first few marbles to remove, since they tend to eliminate any choice; and metals start a few +levels deeper still. This gives the player a lot more room to make a mistake in the beginning. +At least you can enjoy the Undo and Try Again buttons! If you're curious about the inner workings, open dev tools and enable debug logging with the `debug=1` GET parameter.