Skip to content

Instantly share code, notes, and snippets.

@Stiivi
Last active January 16, 2016 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stiivi/aa65a6e5d71ff68a1d0a to your computer and use it in GitHub Desktop.
Save Stiivi/aa65a6e5d71ff68a1d0a to your computer and use it in GitHub Desktop.
# Concepts
# --------
CONCEPT linker
TAG ready
SLOT left, right
CONCEPT link
TAG free
SLOT next
CONCEPT fault
# We pretend to be a link, but there is no 'next' slot
TAG link, free
# Actuators
# ---------
WHERE linker AND NOT BOUND left ON link, free DO
BIND left TO other
IN other UNSET free
SET one
WHERE one ON link AND free DO
BIND right TO other
IN other UNSET free
UNSET one
SET two
WHERE two DO
IN this.left BIND next TO this.right
UNSET two
SET advance
# Should be binding on occupied site allowed?
WHERE advance DO
BIND left TO this.right
UNSET advance
SET cleanup
WHERE cleanup DO
UNBIND right
UNSET cleanup
SET one
# World
# -----
# Example how structure affects function – one faulty element in the
# environment will break construction of a chain.
WORLD main
OBJECT link * 5
OBJECT fault
OBJECT link * 35
OBJECT linker * 3
# Data for visualization
# ----------------------
DATA dot:attributes, linker """fillcolor=gold,style="filled,rounded" """
DATA dot:attributes, fault """fillcolor=coral,style="filled,rounded" """
DATA dot:attributes, free """fillcolor=gray90,style="filled,rounded" """
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment