A program that converts .rie
files into RLEs to paste into Golly.
Instructions
-
Clone this repo.
-
Copy the contents of
golly/Flow6.rule
as text and paste it into Golly. -
Open up
golly/Turing Machine.mc
. It should look something like this:
-
Go back to your terminal and type
cargo run program --clip
. This will first compile the rieasm assembler, which will then run, compiling theprogram.rie
file found in this repository into your clipboard. (This is outdated btw there's a lua script somewhere that will compile the rieasm into your clipboard and paste it in the proper location automatically)
-
Go back to Golly, and follow these instructions to paste the RLE:
(Show Image)
Align your crosshair with the tile marked with green. It should say XY=0 0
on the top bar.Once the cursor is aligned, hit Ctrl+V and left click.
-
Set the step size. Press the
+
and-
keys on your keyboard until it's the right speed.(Show Image)
I recommend 8^0
if you want to track the exact paths of the signals.8^1
if you want to see individual register operations.8^2
if you want to see what the whole program does.
-
Run the simulation by clicking the Green Play button on the top left.
File format
Lines of code are just tabs followed by tokens. It's pretty much like a `.csv` file but with tabs instead of commas.If a line doesn't begin with a tab, it is a comment.
example comment:
cheese elephant
A tab width of 8 is recommended, but feel free to use tab width 4 if you like working with badly aligned instructions, or spaces if you want the program to refuse to compile :v
Note: For display consistency, I will be using spaces in the code.
The first real line of .rie
code inside of the file is a header and must look like this:
state arg goto read reg reg reg
with 0 or more reg
columns. In this case, 3.
The number of reg
columns will specify how many registers the target Turing Machine model has.
The provided Turing Machine file has exactly 4 bits of state and 3 registers, so unless you know how to mod the machine, keep it at 3 registers.
As mentioned earlier for all .rie
code, every token is preceded with tabs, as in <tab>state<tab>arg<tab>goto<tab>read
and so on.
Every valid line after the header must now stick to the format specified by the header:
state
is required. It must be a nonnegative integer, and is whatgoto
looks for when jumping to the next instruction.arg
is also required. It is always paired with state, and is whereread
andreg '?'
go to when finding the next instruction.goto
jumps to the correspondingstate
after the current instruction finishes. defaults to the same value asstate
.read
acts as if a register read a bit and returnedtrue
orfalse
.reg
instructions may either be omitted, or one of the following:>
Push register head one step to the right.<
Pull register head one step to the left.%
Flip the bit at the register head.%<
Executes%
then<
. This is the only "combination" of instructions.[1]?
Reads the bit at the register head. This will become the nextarg
.
- anything after the last
reg
is a comment.
There may only be at most one read. Having no reads will end the program.
[1] Actually, %<
is the more basic instruction. It just so happens that the register "drivers" allow chaining %<
together with >
, making %<>
which is just %
.