LICENSE | ||
README.md |
(set self win)
(set self win) is a mind-bending puzzle game about self-modifying code.
Concept
The programming language in (set self win) is inspired by Lisp, especially the idea of equivalence between code and data. One key difference is that (set self win) has a lot of side effects. In functional programming, side effects make programs difficult to reason about, but here, it makes the game fun! It also has powerful self-referential capabilities using self
and history
.
In the game (set self win), the language is displayed as a graph. When playing (set self win), you can click on any node of the tree, which causes the node and its children to be executed in depth-first order and replaced with its return value. There are no variables because only the graph is allowed to persist state between clicks. You win once the program tree becomes the single node win
. In (set self win), everything is a function! Here is an overview of the functions:
- Numbers: Returns themself.
- Strings: Returns themself.
list
: Returns a list of its children.win
: Returns nothing.self
: Returns the program tree.get i j
: Returns thej
th child ofi
.set i j
: Setsi
toj
, and returnsi
.append i j
: Addsj
as a child toi
.find i j
: Returns the first occurence ofj
ini
.lambda i j
: Returns a functionj
with parameteri
.if i j k
: Ifi
can be coerced into a true boolean, thenj
is returned, otherwisek
is returned.apply i j
: Make the children ofj
the children ofi
and executei
.history
: Returns a tree with root nodelist
and children containing the history of the program tree.