Rule:Squaredance

From LifeWiki
Revision as of 16:26, 20 January 2020 by Ian07 (talk | contribs) (from https://github.com/gollygang/ruletablerepository)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

@RULE Squaredance

@TABLE

n_states:9 neighborhood:Moore symmetries:rotate4

  1. Expanding and shrinking rectangular loops
  2. Dean Hickerson, 12/15-31/2010
  3. Start with a hollow rectangle of cells in states 1 and 2. Change
  4. one cell to state 3 and its clockwise neighbor to state 5 or 6.
  5. The two changed cells will move counterclockwise around the loop,
  6. causing it to grow or shrink whenever they reach a corner.
                                                          1. States #############################
  1. b0 and b1 are bits 0 and 1 in rectangular loop.
  2. H is head of looper.
  3. H3 is used to detect a width 3 rectangle.
  4. Tail of looper is T0 or T1.
  5. Out and In shift edge.

var b0 = {1} # 0-bit in loop var b1 = {2} # 1-bit in loop var H = {3} # head var H3 = {4} # head detecting width 3 var T0 = {5} # tail with 0-bit var T1 = {6} # tail with 1-bit var Out = {7} # shift edge outward var In = {8] # shift edge inward

                                                      1. Variables ###########################

var bit = {b0,b1} var bita = {bit} var bitb = {bit} var bitc = {bit} var bitd = {bit} var notbita = {0,H,H3,T0,T1,Out,In} var notbitb = notbita var notbitc = notbita var shift = {Out,In} var bitorshift = {bit,shift} var bitor0 = {bit,0} var head = {H, H3} var T = {T0,T1} var bitor0orT = {bitor0,T} var xa = {0,1,2,3,4,5,6,7,8} var xb = {xa} var xc = {xa} var xd = {xa} var xe = {xa} var xf = {xa} var xg = {xa} var xh = {xa}

                                        1. Rules ####################
  1. Bit touching exactly 2 others becomes their XOR
  2. straight

b0,b0,xa,notbita,xb,b0,xc,notbitb,xd,b0 b0,b0,xa,notbita,xb,b1,xc,notbitb,xd,b1 b0,b1,xa,notbita,xb,b0,xc,notbitb,xd,b1 b0,b1,xa,notbita,xb,b1,xc,notbitb,xd,b0 b1,b0,xa,notbita,xb,b0,xc,notbitb,xd,b0 b1,b0,xa,notbita,xb,b1,xc,notbitb,xd,b1 b1,b1,xa,notbita,xb,b0,xc,notbitb,xd,b1 b1,b1,xa,notbita,xb,b1,xc,notbitb,xd,b0

  1. bent

b0,b0,xa,b0,xb,notbita,xc,notbitb,xd,b0 b0,b0,xa,b1,xb,notbita,xc,notbitb,xd,b1 b0,b1,xa,b0,xb,notbita,xc,notbitb,xd,b1 b0,b1,xa,b1,xb,notbita,xc,notbitb,xd,b0 b1,b0,xa,b0,xb,notbita,xc,notbitb,xd,b0 b1,b0,xa,b1,xb,notbita,xc,notbitb,xd,b1 b1,b1,xa,b0,xb,notbita,xc,notbitb,xd,b1 b1,b1,xa,b1,xb,notbita,xc,notbitb,xd,b0

  1. bit touching 3 others becomes b0 (irrelevant bit)

bit,bita,xa,bitb,xb,bitc,xc,xd,xe,b0


  1. XOR rule also applies if one neighbor is a tail cell

bit,T0,xa,xb,xc,b0,xe,xf,xg,b0 bit,T0,xa,xb,xc,b1,xe,xf,xg,b1 bit,T0,xa,xb,xc,0,xe,xf,xg,b0 bit,T1,xa,xb,xc,b0,xe,xf,xg,b1 bit,T1,xa,xb,xc,b1,xe,xf,xg,b0 bit,T1,xa,xb,xc,0,xe,xf,xg,b1


  1. Head moves into loop cell

bit,H,T,0,bita,bitb,0,0,0,H3 # Detect width 3 bit,head,xa,xb,xc,xd,xe,xf,xg,H


  1. Head becomes tail ...
  2. on edge

H,0,0,T,0,0,0,b0,0,T0 H,0,0,T,0,0,0,b1,0,T1

  1. approaching corner

H,0,0,T,0,0,bit,b0,0,T0 H,0,0,T,0,0,bit,b1,0,T1

  1. at corner

H,0,0,T,0,b0,0,0,0,T0 H,0,0,T,0,b1,0,0,0,T1

  1. leaving corner

H,T,bit,0,0,b0,0,0,0,T0 H,T,bit,0,0,b1,0,0,0,T1

  1. leaving corner on length 3 edge

H3,T,bit,0,bita,b0,0,0,0,T0 H3,T,bit,0,bita,b1,0,0,0,T1

  1. Otherwise H3 dies.
  2. This allows H3's to be used as transient labels.
  3. H's can be used as permanent ones.

H3,xa,xb,xc,xd,xe,xf,xg,xh,0


  1. Tail becomes b0 (irrelevant bit) ...
  2. on edge

T0,0,0,bitorshift,0,0,0,H,0,b0 T1,0,0,bitorshift,0,0,0,H,0,b0

  1. before corner

T0,0,0,bit,0,0,bita,H,0,b0 T1,0,0,bit,0,0,bita,H,0,b0

  1. leaving corner

T0,bitorshift,bita,0,bitor0,H,0,0,0,b0 T1,bitorshift,bita,0,bitor0,H,0,0,0,b0

  1. Tail becomes shift at corner

T0,0,0,bit,0,H,0,0,0,In T1,0,0,bit,0,H,0,0,0,Out T,0,0,bit,0,H3,0,0,0,Out


  1. Shift travels along edge

bit,0,0,bita,bitor0,0,bitor0orT,shift,0,shift


  1. Out becomes bit or 0

Out,0,0,bit,0,T,0,0,0,bit # at start corner Out,0,0,bit,0,0,bita,bitb,bitc,0 # next to start corner Out,0,0,bit,0,0,0,0,bita,0 # on edge Out,0,0,bit,bita,0,0,0,bitb,0 # before end corner Out,0,0,bit,bita,0,bitb,bitc,bitd,0 # before end corner on length 3 edge

  1. Out moves edge outward (irrelevant bit)

0,0,0,0,bit,Out,0,0,0,b0 # at start corner 0,0,0,0,bit,Out,bita,bitb,0,b0 # next to start corner 0,0,0,0,bit,Out,0,bita,0,b0 # on edge

  1. Corner fills in at end of outward shift

0,0,0,0,0,bit,0,bita,0,b0 # (irrelevant bit)


  1. In becomes 0

In,0,0,bit,0,T,0,0,0,0 # at start corner In,0,0,bit,0,0,bita,0,0,0 # on edge In,0,0,bit,bita,0,bitb,0,0,0 # next to end corner

  1. In moves edge inward (irrelevant bit)

0,In,bit,0,0,0,T,bita,0,b0 # next to start corner 0,In,bit,0,0,0,0,bita,0,b0 # on edge 0,In,bit,bita,bitb,0,0,bitc,0,b0 # next to end corner 0,In,bit,bita,bitb,0,T,bitc,0,b0 # next to end corner on length 3 edge

  1. Corner dies at end of inward shift

bit,0,0,0,0,bita,bitb,0,0,0


  1. Bit touching exactly 1 other becomes it

bit,bita,xa,notbita,xb,notbitb,xc,notbitc,xd,bita