-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Trivial (cheating?) Truth-machine | ||
# Does not test conditionals properly, | ||
# simply runs one or two defined statements '0' or '1' | ||
# based on character symbols rather than values. | ||
# 1 will hit the interpreter's Python recursion limit | ||
# Usage: | ||
# ixqus.py examples/truth-machine-trivial.ιχ <(echo 0) | ||
# ixqus.py examples/truth-machine-trivial.ιχ <(echo 1) | head | ||
|
||
ιιθιιιθ | ||
Ι0χΥΘ | ||
Ι1Υ1Θ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# More interesting truth-machine | ||
# tests the value of the accumulator | ||
# by triggering Deadfish overflow to destroy | ||
# a statement definition to pick an outcome | ||
# Still triggers recursion limits | ||
# Usage: | ||
# zero: | ||
# ixqus.py examples/truth-machine.ιχ | ||
# one: | ||
# ixqus.py <(echo ι) examples/truth-machine.ιχ | head | ||
# Because these "comments" are parsed as code, we need one more χ | ||
# to bring the accumulator back to the intended 0 or 1 | ||
|
||
ΙαΑχΧΘ # define <alpha>: Test for False, break self if acc==0, and call to <ALPHA>=Truth outcome | ||
ΙβΧιιθιιιθχΘ # define <beta>: False action | ||
α # Tests <alpha> before <ALPHA> is defined. If accumulator is 0 <alpha> breaks and <ALPHA> will never execute | ||
ΙΑΧιιθιιιθΥΑΘ # define <ALPHA>: True action (recursive) | ||
αβ # Always execute <beta> and <alpha>, if acc==0 <alpha> will not be defined at this point so is either NOOP or Truth result | ||
Υ # If <ALPHA> recursion not executed, output the False result |