|
@RULE bct |
|
|
|
An implementation of bitwise cyclic tag. |
|
|
|
state 0: Vacuum. |
|
|
|
state 1: Data-tape 0. |
|
state 2: Data-tape 1. |
|
|
|
state 3: Program-tape 0. |
|
state 4: Program-tape 1. |
|
|
|
state 5: Shifter. Moves both itself and the data tape one unit down to render program execution cyclic. |
|
|
|
|
|
|
|
state 6: Transitory program-tape 0. |
|
state 7: Transitory program-tape 1. |
|
|
|
state 8: Pre-copying program-tape 0. (Used when a prgm-tape bit is the x in a 1x instruction) |
|
state 9: Pre-copying program-tape 1. (Ditto) |
|
|
|
state 10: Transitory program-tape 0. |
|
state 11: Transitory program-tape 1. |
|
|
|
state 12: Rightward-moving data-tape 0. |
|
state 13: Rightward-moving data-tape 1. |
|
|
|
state 14: Transitory reflector. |
|
state 15: Ditto but about to turn into normal reflector. |
|
|
|
state 16: To-be-moved-down data-tape 0. |
|
state 17: To-be-moved-down data-tape 1. |
|
|
|
@COLORS |
|
1 235 235 235 lighter gray |
|
2 30 30 30 darker gray |
|
12 235 235 235 lighter gray |
|
13 30 30 30 darker gray |
|
16 235 235 235 lighter gray |
|
17 30 30 30 darker gray |
|
3 200 200 200 light gray |
|
4 90 90 90 dark gray |
|
5 0 255 255 cyan |
|
14 0 255 255 cyan |
|
15 0 255 255 cyan |
|
|
|
@TABLE |
|
n_states:18 |
|
neighborhood:Moore |
|
symmetries:none |
|
|
|
var anya={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17} |
|
var anyb=anya |
|
var anyc=anya |
|
var anyd=anya |
|
var anye=anya |
|
var anyf=anya |
|
var anyg=anya |
|
var anyh=anya |
|
|
|
var dataa={1,2} |
|
var datab=dataa |
|
|
|
var vacdataa={0,1,2} |
|
var vacdatab=vacdataa |
|
|
|
var rdataa={12,13} |
|
var vacrdataa={0,12,13} |
|
|
|
var ddataa={16,17} |
|
var vacddataa={0,16,17} |
|
|
|
# If a shifter is encountered, reflect + shift data tape down 2 cell |
|
# go right |
|
vacddataa,1,anya,anyb,anyc,anyd,anye,anyf,5,16 |
|
vacddataa,2,anya,anyb,anyc,anyd,anye,anyf,5,17 |
|
ddataa,0,anya,anyb,anyc,anyd,anye,anyf,5,0 |
|
# pull down |
|
vacrdataa,16,anya,anyb,anyc,anyd,anye,anyf,anyg,12 |
|
vacrdataa,17,anya,anyb,anyc,anyd,anye,anyf,anyg,13 |
|
# go left |
|
vacdataa,12,5,anya,anyb,anyc,anyd,anye,anyf,1 |
|
vacdataa,13,5,anya,anyb,anyc,anyd,anye,anyf,2 |
|
|
|
# Move rightward-moving data to the right |
|
vacrdataa,anya,anyb,anyc,anyd,anye,anyf,rdataa,anyg,rdataa |
|
rdataa,anya,anyb,anyc,anyd,anye,anyf,0,anyg,0 |
|
|
|
# shift the shifter down two as well |
|
# right |
|
0,5,anya,anyb,anyc,anyd,anye,0,rdataa,14 |
|
# left |
|
0,5,dataa,0,anyb,anyc,anyd,anye,anyd,14 |
|
# finally |
|
0,14,anya,anyb,anyc,anyd,anye,anyf,anyg,15 |
|
14,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,0 |
|
0,15,anya,anyb,anyc,anyd,anye,anyf,anyg,5 |
|
15,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,0 |
|
# delete shifter at end of its input stream |
|
5,0,0,0,ddataa,0,0,0,0,0 |
|
5,0,0,0,0,0,dataa,0,0,0 |
|
|
|
# Shift prgm tape down 1 if rightward data above it |
|
3,rdataa,anya,anyb,anyc,anyd,anye,anyf,anyg,10 |
|
4,rdataa,anya,anyb,anyc,anyd,anye,anyf,anyg,11 |
|
|
|
# If a data bit has a shifter to its right,don't attempt to copy it |
|
dataa,anya,anyb,5,anyc,anyd,anye,anyf,anyg,0 |
|
|
|
# If a prgm-tape 1 is encountered, shift it downward |
|
# and append the command to its left (by copying+shifting down) onto the right end of the data tape, |
|
# if the leftmost bit is 1 -- otherwise just shift it down |
|
# ---- |
|
# check the x in 1x |
|
# leftmost bit 1? |
|
3,anya,2,4,anyb,anyc,anyd,anye,anyf,8 # copy+shift down |
|
4,anya,2,4,anyb,anyc,anyd,anye,anyf,9 # copy+shift down |
|
# ---- |
|
# leftmost bit 0? |
|
3,anya,1,4,anyb,anyc,anyd,anye,anyf,6 # just shift down |
|
4,anya,1,4,anyb,anyc,anyd,anye,anyf,7 # just shift down |
|
# ---- |
|
# shift the 1 in 1x down |
|
4,dataa,anya,anyb,anyc,anyd,anye,anyf,anyg,7 |
|
0,7,anya,anyb,anyc,anyd,anye,anyf,anyg,11 |
|
# ---- |
|
# state 8 becomes state 1 and below it state 3 |
|
8,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,1 |
|
0,8,anya,anyb,anyc,anyd,anye,anyf,anyg,10 |
|
# state 9 becomes state 2 and below it state 4 |
|
9,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,2 |
|
0,9,anya,anyb,anyc,anyd,anye,anyf,anyg,11 |
|
# ---- |
|
# states 10 and 11 become 3 and 4 moving down |
|
0,10,anya,anyb,anyc,anyd,anye,anyf,anyg,3 |
|
0,11,anya,anyb,anyc,anyd,anye,anyf,anyg,4 |
|
10,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,0 |
|
11,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,0 |
|
|
|
# If a bit of data has reached the right end of the tape,append it |
|
# and delete the waiting data |
|
dataa,anya,anyb,0,anyc,datab,anyd,anye,anyf,datab |
|
# next line accounts for single-item data tape being appended to |
|
dataa,anya,anyb,0,datab,anyd,anye,anyf,anyg,datab |
|
dataa,datab,0,anya,anyb,anyc,anyd,anye,anyf,0 |
|
7,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,0 |
|
|
|
# If a prgm-tape 0 is encountered, shift it down and delete the leftmost data-tape bit |
|
3,dataa,anya,anyb,anyc,anyd,anye,anyf,anyg,6 |
|
0,6,anya,anyb,anyc,anyd,anye,anyf,anyg,10 #3 |
|
6,anya,anyb,anyc,anyd,anye,anyf,anyg,anyh,0 |
|
|
|
# Delete the leftmost bit if a program-tape 0 is encountered |
|
0,anya,anyb,dataa,3,anyc,anyd,anye,anyf,0 |
|
|
|
# Keep a data-tape bit in place if it's waiting below the data tape (to prepare for moving to the end) |
|
dataa,datab,anya,anyb,anyc,anyd,anye,anyf,anyg,dataa |
|
0,dataa,anya,datab,anyb,anyc,anyd,anye,anyf,0 |
|
|
|
# Move data tape to the left otherwise |
|
0,anya,dataa,datab,anyb,anyc,anyd,anye,anyf,0 |
|
vacdataa,anya,anyb,vacdatab,anyc,anyd,anye,anyf,anyg,vacdatab |