Mind-bending puzzle game
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Anthony Wang e55b34ebcb
Make the game a graph
1 week ago
LICENSE Initial commit 1 week ago
README.md Make the game a graph 1 week ago

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 the jth child of i.
  • set i j: Sets i to j, and returns i.
  • append i j: Adds j as a child to i.
  • find i j: Returns the first occurence of j in i.
  • lambda i j: Returns a function j with parameter i.
  • if i j k: If i can be coerced into a true boolean, then j is returned, otherwise k is returned.
  • apply i j: Make the children of j the children of i and execute i.
  • history: Returns a tree with root node list and children containing the history of the program tree.