Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Plaudenslager/e1075858d71a90ad9edcbd36a21b6059 to your computer and use it in GitHub Desktop.
Save Plaudenslager/e1075858d71a90ad9edcbd36a21b6059 to your computer and use it in GitHub Desktop.
MapScript/NB example: Tea shop with multi-color costs
cost0 = default 0 usd
cost = cost0 + sum(needs.cost)
fill = cost > .3 usd ? 'red' : cost > .1 usd ? 'yellow' : 'white'
tea:
-> hot-water
-> leaves
stage = 3
hot-water:
-> kettle
-> water
stage = 2
kettle:
-> power
stage = 3
cost0 = 0.1 usd
power:
stage = 4
cost0 = 0.01 usd
water:
stage = 4
cost0 = 0.1 usd
leaves:
stage = 3
cost0 = 0.5 usd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment