From 692a3787c05134eb5384049ad62273f1708d2709 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 9 May 2021 03:56:27 +0300 Subject: [PATCH] Updated Resources: spread functions (markdown) --- Resources:-spread-functions.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Resources:-spread-functions.md b/Resources:-spread-functions.md index bba7cc0..5f330e7 100644 --- a/Resources:-spread-functions.md +++ b/Resources:-spread-functions.md @@ -18,6 +18,12 @@ Build-in functions make models syntax easier to read: * `nth(number)`: true for each nth cell only, e.g. `nth(2)` skips 50% of cells, `nth(5)` skips 80% of cells * `random(number)`: percentage of true, e.g. `50` will return true in 50% of cases +Let's say we want a resource to be generated in hot and highly elevated areas. If altitude is medium, let it also be allowed, but pretty rarely. The model will be something like `minTemp(15) && (minHeight(70) || minHeight(40) && nth(5))`. + +----- +const fn = new Function("i", "minTemp(15) && (minHeight(70) || minHeight(40) && nth(5))"); +fn(i); + Default biome ids: * 0: Marine * 1: Hot desert