This is a toy project based on the excellent TIS-100 game by Zachtronics. If you don’t know about TIS-100, but are still reading this, chances are you’re a good candidate for buying the game. Do that. You can also buy any other game by Zachtronics with your eyes closed, for that matter. Enjoy then read on…
The project uses an ANTLR generated parser to "compile" a TIS-100 program to a set of instructions. Communication over ports is abstracted away and the project comes with an implementation on top of Spring Integration channels.
Of special interest is the fact that problem specifications are actually lua scripts, so the main runner leverages luaj to deal with those.
The project can be built using maven:
mvn package
The main class is eric.bottard.tis100.Runner
and allows running a solution against a problem specification, in a terminal, using fancy ANSI art. Both the solution and the specification support the original game format (examples here and here).
As such, running
mvn package exec:java -Dexec.mainClass=eric.bottard.tis100.Runner -Dexec.args="src/main/resources/spec.lua src/main/resources/41427.0.txt"
in a big enough terminal window yields this:
(This is my solution to the SEQUENCE PEAK DETECTOR
original problem).
This is just a proof of concept, and as such some features from the original game have not been implemented (left as an exercise to the reader, pull requests welcome!):
-
There is no support for the
ANY
andLAST
pseudo-ports -
The Stack node type is not implemented
In addition, you will find that
-
the text UI does not behave exactly as the original (less feedback, e.g. ports, input/output advancement)
-
there is actually no check that the program conforms to the specification
-
nor does the Runner terminate (
CTRL-C
is your friend) -
it does not count cycles, number of instructions or anything