Rule:WiredBrain

From LifeWiki
Revision as of 19:21, 18 June 2022 by Ian07 (talk | contribs) (Created page with "@RULE WiredBrain https://conwaylife.com/forums/viewtopic.php?p=147274#p147274 name = "WiredBrain" n_states = 6 n_neighbors = 8 def transition_function(a): nw, ne, sw, se, n, w, e, s, c = a #unpack neigh = n, ne, e, se, s, sw, w, nw #repack #names background, wire_head, wire_tail, wire, brain_head, brain_tail = range(n_states) brain_head_count = 0 wire_head_count = 0 wire_dead_count = 0 for n in neigh: if n == wire_head: wir...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

@RULE WiredBrain

https://conwaylife.com/forums/viewtopic.php?p=147274#p147274

name = "WiredBrain" n_states = 6 n_neighbors = 8 def transition_function(a):

   nw, ne, sw, se, n, w, e, s, c = a #unpack
   neigh = n, ne, e, se, s, sw, w, nw #repack
   #names    
   background, wire_head, wire_tail, wire, brain_head, brain_tail = range(n_states)
   brain_head_count = 0
   wire_head_count = 0
   wire_dead_count = 0
   for n in neigh:
       if n == wire_head: wire_head_count += 1
       if n == brain_head: brain_head_count += 1
       if n == wire: wire_dead_count += 1 
   #Brain cells are only born if 2 neighbors are brain head,
   #or there are 2 wire heads and no dead wires.
   if c==background:
       if brain_head_count==2 or (wire_head_count==2 and
                                  wire_dead_count==0):
           return brain_head
       else:
           return background
   elif c==wire_head:
       return wire_tail
   elif c==wire_tail:
       return wire
   #Wires are also born from 2 Brain heads.
   elif c==wire:
       if wire_head_count==1 or wire_head_count==2 or brain_head_count==2:
           return wire_head
       else:
           return wire
   elif c==brain_head:
       return brain_tail
   elif c==brain_tail:
       return background
   else:
       raise ValueError("invalid state: " + str(c))

@TREE

num_states=6 num_neighbors=8 num_nodes=121 1 0 2 3 3 5 0 1 0 2 3 1 5 0 2 0 1 0 0 0 0 1 4 2 3 1 5 0 2 1 3 1 1 1 1 2 0 1 0 0 3 0 3 2 4 2 2 5 2 2 3 0 3 1 3 3 2 1 1 1 1 1 1 2 1 3 1 1 3 1 3 4 7 4 8 9 4 3 2 8 2 2 5 2 2 3 3 3 3 0 3 3 5 9 5 5 12 5 4 6 10 6 11 13 6 2 0 0 0 0 0 0 2 1 0 1 1 1 1 3 7 15 7 16 7 7 2 1 1 1 1 3 1 3 8 16 8 8 18 8 2 3 3 3 3 1 3 3 9 7 9 18 20 9 4 10 17 10 19 21 10 3 5 18 5 5 12 5 4 11 19 11 11 23 11 3 12 20 12 12 2 12 4 13 21 13 23 25 13 5 14 22 14 24 26 14 2 0 0 0 0 3 0 3 15 15 15 15 28 15 2 1 0 1 1 3 1 3 16 15 16 16 30 16 2 3 3 3 3 3 3 3 7 28 7 30 32 7 4 17 29 17 31 33 17 3 18 30 18 18 20 18 4 19 31 19 19 35 19 3 20 32 20 20 4 20 4 21 33 21 35 37 21 5 22 34 22 36 38 22 4 23 35 23 23 25 23 5 24 36 24 24 40 24 3 2 4 2 2 2 2 4 25 37 25 25 42 25 5 26 38 26 40 43 26 6 27 39 27 41 44 27 3 28 28 28 28 12 28 4 29 29 29 29 46 29 3 30 28 30 30 20 30 4 31 29 31 31 48 31 3 32 12 32 20 7 32 4 33 46 33 48 50 33 5 34 47 34 49 51 34 3 20 20 20 20 8 20 4 35 48 35 35 53 35 5 36 49 36 36 54 36 3 4 7 4 8 4 4 4 37 50 37 53 56 37 5 38 51 38 54 57 38 6 39 52 39 55 58 39 3 2 8 2 2 2 2 4 25 53 25 25 60 25 5 40 54 40 40 61 40 6 41 55 41 41 62 41 4 42 56 42 60 42 42 5 43 57 43 61 64 43 6 44 58 44 62 65 44 7 45 59 45 63 66 45 3 12 12 12 12 15 12 4 46 46 46 46 68 46 5 47 47 47 47 69 47 3 20 12 20 20 16 20 4 48 46 48 48 71 48 5 49 47 49 49 72 49 4 50 68 50 71 17 50 5 51 69 51 72 74 51 6 52 70 52 73 75 52 3 8 16 8 8 8 8 4 53 71 53 53 77 53 5 54 72 54 54 78 54 6 55 73 55 55 79 55 4 56 17 56 77 56 56 5 57 74 57 78 81 57 6 58 75 58 79 82 58 7 59 76 59 80 83 59 4 60 77 60 60 60 60 5 61 78 61 61 85 61 6 62 79 62 62 86 62 7 63 80 63 63 87 63 5 64 81 64 85 64 64 6 65 82 65 86 89 65 7 66 83 66 87 90 66 8 67 84 67 88 91 67 3 15 15 15 15 15 15 4 68 68 68 68 93 68 5 69 69 69 69 94 69 6 70 70 70 70 95 70 3 16 15 16 16 16 16 4 71 68 71 71 97 71 5 72 69 72 72 98 72 6 73 70 73 73 99 73 4 17 93 17 97 17 17 5 74 94 74 98 101 74 6 75 95 75 99 102 75 7 76 96 76 100 103 76 4 77 97 77 77 77 77 5 78 98 78 78 105 78 6 79 99 79 79 106 79 7 80 100 80 80 107 80 5 81 101 81 105 81 81 6 82 102 82 106 109 82 7 83 103 83 107 110 83 8 84 104 84 108 111 84 5 85 105 85 85 85 85 6 86 106 86 86 113 86 7 87 107 87 87 114 87 8 88 108 88 88 115 88 6 89 109 89 113 89 89 7 90 110 90 114 117 90 8 91 111 91 115 118 91 9 92 112 92 116 119 92

@COLORS

0 0 0 0 1 255 255 0 2 255 0 0 3 107 33 0 4 0 255 255 5 0 0 255 6 20 20 20