Skip to content

Commit

Permalink
special symmetry workaround for supposedly/nutshell#19
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoncoder047 committed May 9, 2022
1 parent dce04d3 commit 4352aba
Showing 1 changed file with 37 additions and 46 deletions.
83 changes: 37 additions & 46 deletions Fusion.ruel
Original file line number Diff line number Diff line change
Expand Up @@ -19,60 +19,66 @@ States:
8: {NTAAHead0} NTAA head 0
9: {NTAATail} NTAA tail
10: {NTAAWire} NTAA wire
--------------NTAA Table----------
0: blank
1: wire {w}
2: wire 0 {h0}
3: wire 1 {h1}
4: tail {t}


@TABLE
states: 5
neighborhood: vonNeumann
neighborhood: Moore
anyNTAAHead = (NTAAHead0, NTAAHead1)
anyhead = (StrongHead, WeakHead, anyNTAAHead)
anyNTAA = (anyNTAAHead, NTAATail, NTAAWire)

h = (h0, h1)
ht = (h, t)
wht = (w, ht)
wt = (w, t)
# --------------NTAA--------------
# 0: blank
# 1: wire {w}
# 2: wire 0 {h0}
# 3: wire 1 {h1}
# 4: tail {t}

symmetries: permute
# h = (h0, h1)
# ht = (h, t)
# wht = (w, ht)
# wt = (w, t)

symmetries: nutshell.AlternatingPermute

# NEVER put a head where there would be an adjacent tail
w, t, any ~ 3; w
# w, t, any ~ 3; w
NTAAWire, N NTAATail; NTAAWire

symmetries: rotate4reflect

# Split at T
w, w, h, w, --wht; [2]
# w, w, h, w, --wht; [2]
NTAAWire, N NTAAWire, E anyNTAAHead, S NTAAWire, W --anyNTAA; [E]

symmetries: permute
symmetries: nutshell.AlternatingPermute

# Signals wait at intersections
w, w ~ 2, any ~ 2; w
# w, w ~ 2, any ~ 2; w
NTAAWire, N NTAAWire, E NTAAWire; NTAAWire

# Sum=1 signal combination
w, h1, h1, any ~ 2; h0
w, h, h0, --h1 ~ 2; [1]
# w, h1, h1, any ~ 2; h0
NTAAWire, N NTAAHead1, E NTAAHead1; NTAAHead0
# w, h, h0, --h1 ~ 2; [1]
NTAAWire, N anyNTAAHead, E NTAAHead0, S --NTAAHead1, W --NTAAHead1; [N]

# Signals
w, h, --h ~ 3; [1]
h, --w ~ 4; t
t, --h ~ 4; w

-----------------
# w, h, --h ~ 3; [1]
NTAAWire, N anyNTAAHead, E --anyNTAAHead, S --anyNTAAHead, W --anyNTAAHead; [N]
# h, --w ~ 4; t
anyNTAAHead, N --NTAAWire, E --NTAAWire, S --NTAAWire, W --NTAAWire; NTAATail
# t, --h ~ 4; w
NTAATail, N --anyNTAAHead, E --anyNTAAHead, S --anyNTAAHead, W --anyNTAAHead; NTAAWire

@TABLE
# -----------------Wireworld++-----------------

neighborhood: Moore
symmetries: permute

anyhead = (StrongHead, WeakHead, NTAAHead1, NTAAHead0)
anyNTAA = (NTAAHead1, NTAAHead0, NTAATail, NTAAWire)

# wireworld heads
# wireworld heads go immediately to tail
(StrongHead, StrongTail), any; [0: (StrongTail, StrongWire)]
(WeakHead, WeakTail), any; [0: (WeakTail, WeakWire)]
# wireworld transitions
# wireworld++ transitions
StrongWire, <12 / (StrongHead, NTAAHead1) / any - (StrongHead, NTAAHead1)>; StrongHead
StrongWire, <2 / (WeakHead, NTAAHead1) / any - (WeakHead, NTAAHead1)>; StrongHead
WeakWire, <12 / (StrongHead, NTAAHead1) / any - (StrongHead, NTAAHead1)>; WeakHead
Expand All @@ -82,27 +88,12 @@ symmetries: rotate4reflect
# blocked by adjacent NTAA head1
(WeakWire, StrongWire), N Background, E (WeakWire, StrongWire), S NTAAHead1, W anyhead; [0]

# NoTomeAtAll
NTAAWire, N (NTAAHead0, NTAAHead1); NTAAWire # A wire with an adjacent head never turns to a head
(NTAAHead0, NTAAHead1), N --NTAAWire, E --NTAAWire, S --NTAAWire, W --NTAAWire; NTAATail # A head only becomes tail if there is no wire
notNTAAHead = --(NTAAHead0, NTAAHead1)
NTAATail, N notNTAAHead, E notNTAAHead, S notNTAAHead, W notNTAAHead; NTAAWire # A tail only becomes wire if there is no head

# use NTAA heads as DECA red/green blocker states
symmetries: permute
(NTAAWire, NTAATail), N --anyNTAA, E --anyNTAA, S --anyNTAA, W --anyNTAA; NTAAHead0
symmetries: rotate4reflect
(NTAAHead0, NTAAHead1), N (StrongHead, StrongTail, WeakHead), E notNTAAHead, S notNTAAHead, W notNTAAHead; [0: (NTAAHead1, NTAAHead0)] # toggle when next to strong head, strong tail, or weak head and no NTAA neighbors

# NTAA XOR/Onehot gates
symmetries: rotate4reflect
NTAAWire, N (NTAAHead1, NTAAHead0), E NTAAWire, S [N], W (Background, NTAAWire); [W: (NTAAHead0, NTAAWire)]
NTAAWire, N (NTAAHead1, NTAAHead0), E NTAAWire, S [N: (NTAAHead0, NTAAHead1)], W (Background, NTAAWire); [W: (NTAAHead1, NTAAWire)]
symmetries: permute
NTAAWire, NTAAWire ~ 2, anyNTAA ~ 2, NTAAWire
NTAAWire, NTAAHead1, NTAAHead0 ~ 2, NTAAWire; NTAAHead1
NTAAWire, (NTAAHead0, NTAAHead1) ~ 3, NTAAWire, NTAAHead0

# activate when Wireworld++heads
NTAAWire, (anyhead - anyNTAA) ~ 1, any; NTAAHead0
NTAAWire, (anyhead - anyNTAA) ~ 2, any; NTAAHead1
Expand Down

0 comments on commit 4352aba

Please sign in to comment.