Logic Grid

For discussion of other cellular automata.
Post Reply
pleion
Posts: 2
Joined: October 21st, 2012, 8:15 am

Logic Grid

Post by pleion »

Hi, I'm new to the forum, but wanted to share my CA. I call it the Logic Grid. It is based around drawing lines on a lattice. I have written a version in javascript at http://sciencevsmagic.net/logicgrid

I have a full explanation of the rules at in a blog post, but in short:
-Each intersection is assigned a type based on the input lines coming in from above, the left, and the diagonal upper left. This makes eight possible types, each represented by a diagram in the controls.

-Each type has its own rules about which output lines to draw below, to the right and diagonally to the lower right. These rules can be changed by the user.

-The top left corner is an origin where all three lines are on by default.

-Intersections are only assigned a type after the lines above and to the left have been drawn, so outputs of one row change the types of the next.
I'm pretty new to this type of thing, so I would love to hear any feedback about what it is that I have found. Are there any simpler ways to express the same rules?

You can also share rules by URL, please post any interesting ones you find.
User avatar
Extrementhusiast
Posts: 1970
Joined: June 16th, 2009, 11:24 pm
Location: USA

Re: Logic Grid

Post by Extrementhusiast »

I think that a good rule to look at would be Life on the Edge, or its variant, Life on the Slope. Both seem to be quite similar to your rule.
I Like My Heisenburps! (and others)
User avatar
dvgrn
Moderator
Posts: 12047
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Logic Grid

Post by dvgrn »

pleion wrote:Are there any simpler ways to express the same rules?
I wouldn't be surprised if one of the rulesets described in Wolfram's New Kind of Science was somehow isomorphic to your Logic Grid rules, but I can't think of anything offhand. The odd thing about the Logic Grid rules is that the pattern grows like a Wolfram 1D rule, but in a square rather than row by row.

Anyway, it's certainly closer to 1D rules than to a 2D everything-changing-with-time rule like Life on the [Edge|Slope] (which you can find via Golly's Help > Online Archives > Rule Table Repository, by the way. There's a sample 1D rule in Golly's Patterns folder -- Hashlife/wolfram22.mc .)

-- Hmm, that might mean that you could cut your Logic Grid patterns in half along the main diagonal, and then translate your rules into _two_ of Wolfram's 1D rules, with some constraints. Each rule could be adjusted to generate a pattern equivalent to one of the diagonal halves of the Logic Grid square.

I don't think that counts as "simpler", though! And in cases where there's complicated stuff going on along the main diagonal, you couldn't stick the two rules together at the diagonal in any simple way to get the same result. Quite often there's communication going on between the adjacent sections of the two half-rules.

Wolfram definitely experimented with 1D CAs where you apply different rules in alternate generations, but I don't recall if he tried applying a different rule to the left and right halves of the same generation. (I certainly wouldn't be surprised -- seems like he tried just about everything at some point!)

Anyway, that might actually get you to an isomorphic fun-house-mirror distortion of your Logic Grid, where you bend the bottom edge and right side of the square to make one long line... This would still be a rather messy equivalent to your nice simple geometric rule design, but it might tell you that you're likely to get the same general kinds of patterns with LogicGrid as Wolfram documented in _NKS_ -- regular, fractal, chaotic, possibly Turing-complete.
pleion
Posts: 2
Joined: October 21st, 2012, 8:15 am

Re: Logic Grid

Post by pleion »

Thanks so much for the great replies.

I had been thinking along similar lines about it being almost 1D, but couldn't quite visualize a way it work work on a single line that only requires knowledge of the state before. Your funhouse mirror skewing would seem to do the trick!

I've drawn out a few rules on a piece of paper to make sure it works and it all seems fine. I guess this isn't simpler in most measures due to the different angles used either side of the center and it comes out uglier, but it does make it truly 1D.

Looks like I might have some reading to do once uni winds up re:a new kind of science.
User avatar
Tropylium
Posts: 421
Joined: May 31st, 2011, 7:12 pm
Location: Finland

Re: Logic Grid

Post by Tropylium »

dvgrn wrote:The odd thing about the Logic Grid rules is that the pattern grows like a Wolfram 1D rule, but in a square rather than row by row.
Well, you can get somewhat similar effects in any Life-like CA with B1 or B2 on and no death.

A Logic Grid-like CA that grows in multiple directions, or does things other than just grow, does not seem hard to imagine. For a simple example:
1) A point with less than three lines ending in it will sprout orthogonal lines
2) A point with 3 lines ending in it will sprout diagonal lines
3) More than three lines meeting will die

Here are the first few generations grown from a single point:

Code: Select all

...
.O.
...

..O..
..|..
O-O-O
..|..
..O..

....O....
....|....
..O-O-O..
..|...|..
O-O...O-O
..|...|..
..O-O-O..
....|....
....O....

......O......
......|......
....O-O-O....
....|\|/|....
..O-O-O-O-O..
..|\|/.\|/|..
O-O-O...O-O-O
..|/|\./|\|..
..O-O-O-O-O..
....|/|\|....
....O-O-O....
......|......
......O......

........O........
........|........
....O.O-O-O.O....
.....\./.\./.....
..O...O...O...O..
...\./.....\./...
..O.O.......O.O..
..|/.........\|..
O-O...........O-O
..|\........./|..
..O.O.......O.O..
.../.\...../.\...
..O...O...O...O..
...../.\./.\.....
....O.O-O-O.O....
........|........
........O........

..........O..........
..........|..........
......O.O-O-O.O......
......|.|...|.|......
....O-O—O...O-O-O....
....|.|\|...|/|.|....
..O-O-O.O...O.O-O-O..
....|\./.\./.\./|....
..O-O-O...O...O-O-O..
..|....\...../....|..
O-O.....O...O.....O-O
..|..../.....\....|..
..O-O-O...O...X-O-O..
....|/.\./.\./.\|....
..O-O-O.O...X.A-O-O..
....|.|/|...|\|.|....
....O-O-O...O-O-O....
......|.|...|.|......
......O.O-O-O.O......
..........|..........
..........O..........
Well, maybe not so simple: at this point we run into the problem of what will happen if some point (e.g. "A" in the last pattern) starts growing towards another point that dies ("X")?

(Perhaps we should consider splitting the rules in two halves: on odd generations "lines" will survive/die/be born; on even generations "dots" will.)
IntKecsk
Posts: 3
Joined: July 17th, 2011, 4:06 pm

Re: Logic Grid

Post by IntKecsk »

I've implemented Logic Grid rules in Golly. Here are two rule-generating scripts:
LoGrid-gen.py:

Code: Select all

import golly
from string import Template
spec = golly.getstring(
'''This script will generate the Logic Grid rule for given specification
Please enter 8 octal digits(0-7) describing the configuration for

1st digit - no incoming lines
2nd digit - line coming from the upper left
3rd digit - line coming from above
4th digit - lines coming from above and from the upper left
5th digit - line coming from the left
6th digit - lines coming from the left and from the upper left
7th digit - lines coming from the left and from above
8th digit - lines coming from the left, from above, and from the upper left

If in the rule "when no lines are incoming, no lines are outgoing",
consider using the "LoGrid_bl-gen.py" script.

Digits mean:
0 - no outgoing lines
1 - line going to the lower right
2 - line going down
3 - lines going down and to the lower light
4 - line going to the right
5 - lines going to the right and to the lower light
6 - lines going to the right and down
7 - lines going to the right, down and to the lower light
''', "", "Enter rule specification")
if len(spec)!=8:
	golly.exit("Incorrect specification string")

trst = []
for ch in spec:
	if ord("0") <= ord(ch) <= ord("7"):
		trst.append(ord(ch)-ord("0")+1)
	else:
		golly.exit("Incorrect specification string")

ruletpl=Template(
'''@RULE $rname
Rule for Logic Grid.
Generated by LoGrid-gen.py script.

Each intersection is assigned a type based on the input lines coming in from above, the left, and the diagonal upper left.
This makes eight possible types, each represented by a diagram in the controls.
Each type has its own rules about which output lines to draw below, to the right and diagonally to the lower right. These are determined by specification.
Intersections are only assigned a type after the lines above and to the left have been drawn, so outputs of one row change the types of the next, cascading to infinity.

This rule builds Logic Grids step by step.
It has separate state for no outgoing lines.

States:
0 - background/yet undefined
1 - no outgoing lines
2 - line going to the lower right
3 - line going down
4 - lines going down and to the lower light
5 - line going to the right
6 - line going to the right and to the lower light
7 - line going to the right and down
8 - line going to the right, down and to the lower light

Specification is $sspec, rule images:
$ris1
$ris2
$ris3

"Logic Grid" rulespace by Nico Disseldorp.
Coding, tables, icons by Anton Sanarov.

@TABLE
n_states: 9
neighborhood:Moore
symmetries:none

var h={5,6,7,8}
var nh={0,1,2,3,4}
var v={3,4,7,8}
var nv={0,1,2,5,6}
var d={2,4,6,8}
var nd={0,1,3,5,7}
var z={0,1,2,3,4,5,6,7,8}
var y={z}
var x={z}
var w={z}
var u={z}
var t={z}

0,0,u,w,x,y,z,0,t,0
0,nv,u,w,x,y,z,nh,nd,$s1
0,nv,u,w,x,y,z,nh,d,$s2
0,v,u,w,x,y,z,nh,nd,$s3
0,v,u,w,x,y,z,nh,d,$s4
0,nv,u,w,x,y,z,h,nd,$s5
0,nv,u,w,x,y,z,h,d,$s6
0,v,u,w,x,y,z,h,nd,$s7
0,v,u,w,x,y,z,h,d,$s8
''')

rl1=[ "   ", "\\  ",  " | ", "\\| "]
rl2=[[" O ",  " O-"],["-O ",  "-O-"]];
rl3=[ "   ",  "  \\", " | ",  " |\\"]
def addrl(lin, lout, r):
	r[0].append(rl1[lin&3]);
	r[1].append(rl2[lin>>2][lout>>2]);
	r[2].append(rl3[lout&3]);
	
rulename = "LoGrid-"+spec;

ris=[[],[],[]]
for i in xrange(0,8):
	addrl(i, ord(spec[i])-ord('0'), ris)
	
ruletxt = ruletpl.substitute(
rname=rulename,
sspec = spec,
ris1=" ".join(ris[0]),
ris2=" ".join(ris[1]),
ris3=" ".join(ris[2]),
s1=trst[0],
s2=trst[1],
s3=trst[2],
s4=trst[3],
s5=trst[4],
s6=trst[5],
s7=trst[6],
s8=trst[7])

fname = golly.getdir("rules")+rulename+".rule"
f = open(fname, "w")
f.write(ruletxt)
f.close()
golly.new(rulename+"-test")
golly.setrule(rulename)
golly.show("Created "+rulename+".rule and selected that rule.")
LoGrid_bl-gen.py:

Code: Select all

import golly
from string import Template
spec = golly.getstring(
'''This script will generate the Logic Grid rule for given specification
(with implicit blank cell)
Please enter 7 octal digits(0-7) describing the configuration for

1st digit - line coming from the upper left
2nd digit - line coming from above
3rd digit - lines coming from above and from the upper left
4th digit - line coming from the left
5th digit - lines coming from the left and from the upper left
6th digit - lines coming from the left and from above
7th digit - lines coming from the left, from above, and from the upper left

This script is for rules in which if no lines are incoming, no lines are outgoing.
If this is not the case, please use the "LoGrid-gen.py" script.

Digits mean:
0 - no outgoing lines
1 - line going to the lower right
2 - line going down
3 - lines going down and to the lower light
4 - line going to the right
5 - lines going to the right and to the lower light
6 - lines going to the right and down
7 - lines going to the right, down and to the lower light
''', "", "Enter rule specification")
if len(spec)!=7:
	golly.exit("Incorrect specification string")

trst = []
for ch in spec:
	if ord("0") <= ord(ch) <= ord("7"):
		trst.append(ord(ch)-ord("0"))
	else:
		golly.exit("Incorrect specification string")

ruletpl=Template(
'''@RULE $rname
Rule for Logic Grid.
Generated by LoGrid-gen.py script.

Each intersection is assigned a type based on the input lines coming in from above, the left, and the diagonal upper left.
This makes eight possible types, each represented by a diagram in the controls.
Each type has its own rules about which output lines to draw below, to the right and diagonally to the lower right. These are determined by specification.
Intersections are only assigned a type after the lines above and to the left have been drawn, so outputs of one row change the types of the next, cascading to infinity.

This rule builds Logic Grids step by step.
No outgoing lines are represented by state 0

States:
0 - background/no outgoing lines
1 - line going to the lower right 
2 - line going down 
3 - lines going down and to the lower light 
4 - line going to the right 
5 - line going to the right and to the lower light 
6 - line going to the right and down 
7 - line going to the right, down and to the lower light 
8 - synchronization state

Specification is $sspec, rule images:
$ris1
$ris2
$ris3

"Logic Grid" Rulespace by Nico Disseldorp.
Coding, tables, icons by Anton Sanarov.

@TABLE
n_states: 9
neighborhood:Moore
symmetries:none

var h={4,5,6,7}
var nh={0,1,2,3}
var v={2,3,6,7}
var nv={0,1,4,5}
var d={1,3,5,7}
var nd={0,2,4,6}
var z={0,1,2,3,4,5,6,7,8}
var y={z}
var x={z}
var w={z}
var u={z}
var c={0,8}
var cc={c}

0,c,u,w,x,y,z,cc,d,8
c,nv,u,w,x,y,z,nh,d,$s1
c,v,u,w,x,y,z,nh,nd,$s2
c,v,u,w,x,y,z,nh,d,$s3
c,nv,u,w,x,y,z,h,nd,$s4
c,nv,u,w,x,y,z,h,d,$s5
c,v,u,w,x,y,z,h,nd,$s6
c,v,u,w,x,y,z,h,d,$s7
''')

rl1=[ "   ", "\\  ",  " | ", "\\| "]
rl2=[[" O ",  " O-"],["-O ",  "-O-"]];
rl3=[ "   ",  "  \\", " | ",  " |\\"]
def addrl(lin, lout, r):
	r[0].append(rl1[lin&3]);
	r[1].append(rl2[lin>>2][lout>>2]);
	r[2].append(rl3[lout&3]);
	
rulename = "LoGrid_bl-"+spec;

ris=[["   "],[" O "],["   "]]

for i in xrange(1,8):
	addrl(i, ord(spec[i-1])-ord('0'), ris)


ruletxt = ruletpl.substitute(
rname=rulename,
sspec=spec,
ris1=" ".join(ris[0]),
ris2=" ".join(ris[1]),
ris3=" ".join(ris[2]),
s1=trst[0],
s2=trst[1],
s3=trst[2],
s4=trst[3],
s5=trst[4],
s6=trst[5],
s7=trst[6])

fname = golly.getdir("rules")+rulename+".rule"
f = open(fname, "w")
f.write(ruletxt)
f.close()
golly.new(rulename+"-test")
golly.setrule(rulename)
golly.show("Created "+rulename+".rule and selected that rule.")
Here are the colors and icons for generated rules:
LoGrid-shared.rule

Code: Select all

@RULE LoGrid-shared
Colors and icons for Logic Grid rules with explicit empty intersections

@TABLE
n_states: 9
neighborhood:Moore
symmetries:none

@COLORS
0   0   0   0    background
1 128 128 128    no lines
2 128 128 255    diagonal
3 128 255 128    vertical
4 128 255 255    vert diag
5 255 128 128    horizontal
6 255 128 255    hor diag
7 255 255 128    hor vert
8 255 255 255    all lines

@ICONS

XPM
/* width height num_colors chars_per_pixel */
"31 248 2 1"
/* colors */
". c #000000"
"4 c #FFFFFF"
/* icon for state 1 */
"444............................"
"444............................"
"444............................"
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
/* icon for state 2 */
"444............................"
"4444..........................."
"44444.........................."
".44444........................."
"..44444........................"
"...44444......................."
"....44444......................"
".....44444....................."
"......44444...................."
".......44444..................."
"........44444.................."
".........44444................."
"..........44444................"
"...........44444..............."
"............44444.............."
".............44444............."
"..............44444............"
"...............44444..........."
"................44444.........."
".................44444........."
"..................44444........"
"...................44444......."
"....................44444......"
".....................44444....."
"......................44444...."
".......................44444..."
"........................44444.."
".........................44444."
"..........................44444"
"...........................4444"
"............................444"
/* icon for state 3 */
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
/* icon for state 4 */
"444............................"
"4444..........................."
"44444.........................."
"444444........................."
"4444444........................"
"44444444......................."
"444.44444......................"
"444..44444....................."
"444...44444...................."
"444....44444..................."
"444.....44444.................."
"444......44444................."
"444.......44444................"
"444........44444..............."
"444.........44444.............."
"444..........44444............."
"444...........44444............"
"444............44444..........."
"444.............44444.........."
"444..............44444........."
"444...............44444........"
"444................44444......."
"444.................44444......"
"444..................44444....."
"444...................44444...."
"444....................44444..."
"444.....................44444.."
"444......................44444."
"444.......................44444"
"444........................4444"
"444.........................444"
/* icon for state 5 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
/* icon for state 6 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
".44444........................."
"..44444........................"
"...44444......................."
"....44444......................"
".....44444....................."
"......44444...................."
".......44444..................."
"........44444.................."
".........44444................."
"..........44444................"
"...........44444..............."
"............44444.............."
".............44444............."
"..............44444............"
"...............44444..........."
"................44444.........."
".................44444........."
"..................44444........"
"...................44444......."
"....................44444......"
".....................44444....."
"......................44444...."
".......................44444..."
"........................44444.."
".........................44444."
"..........................44444"
"...........................4444"
"............................444"
/* icon for state 7 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
/* icon for state 8 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"444444........................."
"4444444........................"
"44444444......................."
"444.44444......................"
"444..44444....................."
"444...44444...................."
"444....44444..................."
"444.....44444.................."
"444......44444................."
"444.......44444................"
"444........44444..............."
"444.........44444.............."
"444..........44444............."
"444...........44444............"
"444............44444..........."
"444.............44444.........."
"444..............44444........."
"444...............44444........"
"444................44444......."
"444.................44444......"
"444..................44444....."
"444...................44444...."
"444....................44444..."
"444.....................44444.."
"444......................44444."
"444.......................44444"
"444........................4444"
"444.........................444"

XPM
/* width height num_colors chars_per_pixel */
"15 120 2 1"
/* colors */
". c #000000"
"4 c #FFFFFF"
/* icon for state 1 */
"44............."
"44............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
/* icon for state 2 */
"44............."
"444............"
".444..........."
"..444.........."
"...444........."
"....444........"
".....444......."
"......444......"
".......444....."
"........444...."
".........444..."
"..........444.."
"...........444."
"............444"
".............44"
/* icon for state 3 */
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
/* icon for state 4 */
"44............."
"444............"
"4444..........."
"44444.........."
"44.444........."
"44..444........"
"44...444......."
"44....444......"
"44.....444....."
"44......444...."
"44.......444..."
"44........444.."
"44.........444."
"44..........444"
"44...........44"
/* icon for state 5 */
"444444444444444"
"444444444444444"
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
/* icon for state 6 */
"444444444444444"
"444444444444444"
".444..........."
"..444.........."
"...444........."
"....444........"
".....444......."
"......444......"
".......444....."
"........444...."
".........444..."
"..........444.."
"...........444."
"............444"
".............44"
/* icon for state 7 */
"444444444444444"
"444444444444444"
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
/* icon for state 8 */
"444444444444444"
"444444444444444"
"4444..........."
"44444.........."
"44.444........."
"44..444........"
"44...444......."
"44....444......"
"44.....444....."
"44......444...."
"44.......444..."
"44........444.."
"44.........444."
"44..........444"
"44...........44"

XPM
/* width height num_colors chars_per_pixel */
"7 56 2 1"
/* colors */
". c #000000"
"4 c #FFFFFF"
/* icon for state 1 */
"4......"
"......."
"......."
"......."
"......."
"......."
"......."
/* icon for state 2 */
"4......"
".4....."
"..4...."
"...4..."
"....4.."
".....4."
"......4"
/* icon for state 3 */
"4......"
"4......"
"4......"
"4......"
"4......"
"4......"
"4......"
/* icon for state 4 */
"4......"
"44....."
"4.4...."
"4..4..."
"4...4.."
"4....4."
"4.....4"
/* icon for state 5 */
"4444444"
"......."
"......."
"......."
"......."
"......."
"......."
/* icon for state 6 */
"4444444"
".4....."
"..4...."
"...4..."
"....4.."
".....4."
"......4"
/* icon for state 7 */
"4444444"
"4......"
"4......"
"4......"
"4......"
"4......"
"4......"
/* icon for state 8 */
"4444444"
"44....."
"4.4...."
"4..4..."
"4...4.."
"4....4."
"4.....4"
LoGrid_bl-shared.rule

Code: Select all

@RULE LoGrid_bl-shared
Colors and icons for Logic Grid rules with implicit empty intersections

@TABLE
n_states: 9
neighborhood:Moore
symmetries:none

@COLORS
0   0   0   0    background/no lines
1 128 128 255    diagonal
2 128 255 128    vertical
3 128 255 255    vert diag
4 255 128 128    horizonta
5 255 128 255    hor diag
6 255 255 128    hor vert
7 255 255 255    all lines
8 128 128 128    waiting for edge-adjacent cells

@ICONS

XPM
/* width height num_colors chars_per_pixel */
"31 248 2 1"
/* colors */
". c #000000"
"4 c #FFFFFF"
/* icon for state 1 */
"444............................"
"4444..........................."
"44444.........................."
".44444........................."
"..44444........................"
"...44444......................."
"....44444......................"
".....44444....................."
"......44444...................."
".......44444..................."
"........44444.................."
".........44444................."
"..........44444................"
"...........44444..............."
"............44444.............."
".............44444............."
"..............44444............"
"...............44444..........."
"................44444.........."
".................44444........."
"..................44444........"
"...................44444......."
"....................44444......"
".....................44444....."
"......................44444...."
".......................44444..."
"........................44444.."
".........................44444."
"..........................44444"
"...........................4444"
"............................444"
/* icon for state 2 */
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
/* icon for state 3 */
"444............................"
"4444..........................."
"44444.........................."
"444444........................."
"4444444........................"
"44444444......................."
"444.44444......................"
"444..44444....................."
"444...44444...................."
"444....44444..................."
"444.....44444.................."
"444......44444................."
"444.......44444................"
"444........44444..............."
"444.........44444.............."
"444..........44444............."
"444...........44444............"
"444............44444..........."
"444.............44444.........."
"444..............44444........."
"444...............44444........"
"444................44444......."
"444.................44444......"
"444..................44444....."
"444...................44444...."
"444....................44444..."
"444.....................44444.."
"444......................44444."
"444.......................44444"
"444........................4444"
"444.........................444"
/* icon for state 4 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
/* icon for state 5 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
".44444........................."
"..44444........................"
"...44444......................."
"....44444......................"
".....44444....................."
"......44444...................."
".......44444..................."
"........44444.................."
".........44444................."
"..........44444................"
"...........44444..............."
"............44444.............."
".............44444............."
"..............44444............"
"...............44444..........."
"................44444.........."
".................44444........."
"..................44444........"
"...................44444......."
"....................44444......"
".....................44444....."
"......................44444...."
".......................44444..."
"........................44444.."
".........................44444."
"..........................44444"
"...........................4444"
"............................444"
/* icon for state 6 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
"444............................"
/* icon for state 7 */
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"4444444444444444444444444444444"
"444444........................."
"4444444........................"
"44444444......................."
"444.44444......................"
"444..44444....................."
"444...44444...................."
"444....44444..................."
"444.....44444.................."
"444......44444................."
"444.......44444................"
"444........44444..............."
"444.........44444.............."
"444..........44444............."
"444...........44444............"
"444............44444..........."
"444.............44444.........."
"444..............44444........."
"444...............44444........"
"444................44444......."
"444.................44444......"
"444..................44444....."
"444...................44444...."
"444....................44444..."
"444.....................44444.."
"444......................44444."
"444.......................44444"
"444........................4444"
"444.........................444"
/* icon for state 8 */
"4.............................."
".4............................."
"..4............................"
"...4..........................."
"....4.........................."
".....4........................."
"......4........................"
".......4......................."
"........4......................"
".........4....................."
"..........4...................."
"...........4...4..............."
"............4..4..............."
".............4.4..............."
"..............44..............."
"...........44444..............."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."
"..............................."

XPM
/* width height num_colors chars_per_pixel */
"15 120 2 1"
/* colors */
". c #000000"
"4 c #FFFFFF"
/* icon for state 1 */
"44............."
"444............"
".444..........."
"..444.........."
"...444........."
"....444........"
".....444......."
"......444......"
".......444....."
"........444...."
".........444..."
"..........444.."
"...........444."
"............444"
".............44"
/* icon for state 2 */
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
/* icon for state 3 */
"44............."
"444............"
"4444..........."
"44444.........."
"44.444........."
"44..444........"
"44...444......."
"44....444......"
"44.....444....."
"44......444...."
"44.......444..."
"44........444.."
"44.........444."
"44..........444"
"44...........44"
/* icon for state 4 */
"444444444444444"
"444444444444444"
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
/* icon for state 5 */
"444444444444444"
"444444444444444"
".444..........."
"..444.........."
"...444........."
"....444........"
".....444......."
"......444......"
".......444....."
"........444...."
".........444..."
"..........444.."
"...........444."
"............444"
".............44"
/* icon for state 6 */
"444444444444444"
"444444444444444"
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
"44............."
/* icon for state 7 */
"444444444444444"
"444444444444444"
"4444..........."
"44444.........."
"44.444........."
"44..444........"
"44...444......."
"44....444......"
"44.....444....."
"44......444...."
"44.......444..."
"44........444.."
"44.........444."
"44..........444"
"44...........44"
/* icon for state 8 */
"4.............."
".4............."
"..4............"
"...4..........."
"....4..4......."
".....4.4......."
"......44......."
"....4444......."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."
"..............."

XPM
/* width height num_colors chars_per_pixel */
"7 56 2 1"
/* colors */
". c #000000"
"4 c #FFFFFF"
/* icon for state 1 */
"4......"
".4....."
"..4...."
"...4..."
"....4.."
".....4."
"......4"
/* icon for state 2 */
"4......"
"4......"
"4......"
"4......"
"4......"
"4......"
"4......"
/* icon for state 3 */
"4......"
"44....."
"4.4...."
"4..4..."
"4...4.."
"4....4."
"4.....4"
/* icon for state 4 */
"4444444"
"......."
"......."
"......."
"......."
"......."
"......."
/* icon for state 5 */
"4444444"
".4....."
"..4...."
"...4..."
"....4.."
".....4."
"......4"
/* icon for state 6 */
"4444444"
"4......"
"4......"
"4......"
"4......"
"4......"
"4......"
/* icon for state 7 */
"4444444"
"44....."
"4.4...."
"4..4..."
"4...4.."
"4....4."
"4.....4"
/* icon for state 8 */
"4......"
".4.4..."
"..44..."
".444..."
"......."
"......."
"......."
IntKecsk
Posts: 3
Joined: July 17th, 2011, 4:06 pm

Re: Logic Grid

Post by IntKecsk »

The LoGrid family of rules uses 8 states for different types of intersections, and state 0 as backrgound(undefined) state. The each cell becomes defined(state>0) after one of the 2 adjacent cells becomes defined.

The LoGrid_bl family of rules may be used in those Logic Grid rules, in which no incoming lines imply no outcoming lines. In the LoGrid_bl, the intersection with no outcoming lines is represented, as well as background, by state 0.
There is also an auxiliary synchronization state (it is used in cases where there is line coming from upper left, but the adjacent cells are yet undefined, and we need to wait).

Here is the example of a generated rule (rule 01646210 (#382C42), the default on the LogicGrid site)

Code: Select all

@RULE LoGrid_bl-1646210
Rule for Logic Grid.
Generated by LoGrid-gen.py script.

Each intersection is assigned a type based on the input lines coming in from above, the left, and the diagonal upper left.
This makes eight possible types, each represented by a diagram in the controls.
Each type has its own rules about which output lines to draw below, to the right and diagonally to the lower right. These are determined by specification.
Intersections are only assigned a type after the lines above and to the left have been drawn, so outputs of one row change the types of the next, cascading to infinity.

This rule builds Logic Grids step by step.
No outgoing lines are represented by state 0

States:
0 - background/no outgoing lines
1 - line going to the lower right 
2 - line going down 
3 - lines going down and to the lower light 
4 - line going to the right 
5 - line going to the right and to the lower light 
6 - line going to the right and down 
7 - line going to the right, down and to the lower light 
8 - synchronization state

Specification is 1646210, rule images:
    \    |  \|      \    |  \| 
 O   O   O-  O- -O- -O  -O  -O 
      \  |       |   |    \    

"Logic Grid" Rulespace by Nico Disseldorp.
Coding, tables, icons by Anton Sanarov.

@TABLE
n_states: 9
neighborhood:Moore
symmetries:none

var h={4,5,6,7}
var nh={0,1,2,3}
var v={2,3,6,7}
var nv={0,1,4,5}
var d={1,3,5,7}
var nd={0,2,4,6}
var z={0,1,2,3,4,5,6,7,8}
var y={z}
var x={z}
var w={z}
var u={z}
var c={0,8}
var cc={c}

0,c,u,w,x,y,z,cc,d,8
c,nv,u,w,x,y,z,nh,d,1
c,v,u,w,x,y,z,nh,nd,6
c,v,u,w,x,y,z,nh,d,4
c,nv,u,w,x,y,z,h,nd,6
c,nv,u,w,x,y,z,h,d,2
c,v,u,w,x,y,z,h,nd,1
c,v,u,w,x,y,z,h,d,0
IntKecsk
Posts: 3
Joined: July 17th, 2011, 4:06 pm

Re: Logic Grid

Post by IntKecsk »

The http://sciencevsmagic.net/logicgrid/#22656F (03701353) is similar to W110, but skewed to the left

Code: Select all

@RULE LoGrid_bl-3701353
Rule for Logic Grid.
Generated by LoGrid-gen.py script.

Each intersection is assigned a type based on the input lines coming in from above, the left, and the diagonal upper left.
This makes eight possible types, each represented by a diagram in the controls.
Each type has its own rules about which output lines to draw below, to the right and diagonally to the lower right. These are determined by specification.
Intersections are only assigned a type after the lines above and to the left have been drawn, so outputs of one row change the types of the next, cascading to infinity.

This rule builds Logic Grids step by step.
No outgoing lines are represented by state 0

States:
0 - background/no outgoing lines
1 - line going to the lower right 
2 - line going down 
3 - lines going down and to the lower light 
4 - line going to the right 
5 - line going to the right and to the lower light 
6 - line going to the right and down 
7 - line going to the right, down and to the lower light 
8 - synchronization state

Specification is 3701353, rule images:
    \    |  \|      \    |  \| 
 O   O   O-  O  -O  -O  -O- -O 
     |\  |\       \  |\   \  |\

"Logic Grid" Rulespace by Nico Disseldorp.
Coding, tables, icons by Anton Sanarov.

@TABLE
n_states: 9
neighborhood:Moore
symmetries:none

var h={4,5,6,7}
var nh={0,1,2,3}
var v={2,3,6,7}
var nv={0,1,4,5}
var d={1,3,5,7}
var nd={0,2,4,6}
var z={0,1,2,3,4,5,6,7,8}
var y={z}
var x={z}
var w={z}
var u={z}
var c={0,8}
var cc={c}

0,c,u,w,x,y,z,cc,d,8
c,nv,u,w,x,y,z,nh,d,3
c,v,u,w,x,y,z,nh,nd,7
c,v,u,w,x,y,z,nh,d,0
c,nv,u,w,x,y,z,h,nd,1
c,nv,u,w,x,y,z,h,d,3
c,v,u,w,x,y,z,h,nd,5
c,v,u,w,x,y,z,h,d,3

Post Reply