Symbols
In the SandPond engine, there are already some in-built input and output symbols. You can also make your own symbols with these keywords. Define what they do by writing a JavaScript function. Name the arguments you want to use from the event arguments list.
Given
All given inputs must be true for a rule to be chosen.
given W (element) => element == Water
W => _
@ @If there is a water atom above me, delete it.
Change
change outputs say what atom to put in a space.
change W () => new Water()
@ => @
_ WThis makes a water atom and places it below.
Keep
keep outputs don't do anything. They just leave that space how it is.
This does nothing...
Keeps can still have a function like usual, so they are useful for side-effects.
Select
select inputs save data that can be used in an output.
This selects a water atom below, and swaps places with it.
Check
All check inputs must be true for a rule to be chosen. Only one check function is done per symbol. Unlike given, it is never cached during an event.
Origin
origin symbols show where the centre of the diagram is.
Last updated
Was this helpful?