The MAP Syntax

For discussion of other cellular automata.
Post Reply
User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

The MAP Syntax

Post by gameoflifemaniac » July 1st, 2017, 4:53 am

How does the MAP syntax work?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
Rhombic
Posts: 1072
Joined: June 1st, 2013, 5:41 pm

Re: The MAP syntax

Post by Rhombic » July 1st, 2017, 8:38 am

It's explained in the new Golly.
A string of 512 binary digits containing info on births and deaths is then summarised in base 64.
SoL : FreeElectronics : DeadlyEnemies : 6a-ite : Rule X3VI
what is “sesame oil”?

User avatar
dvgrn
Moderator
Posts: 10695
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: The MAP syntax

Post by dvgrn » July 1st, 2017, 9:14 am

gameoflifemaniac wrote:How does the MAP syntax work?
This answer to a MAP-related question might also be useful to walk through. It's a little hard to wrap one's head around at first -- the position of each binary digit is itself a neighborhood pattern encoded in binary. Same kind of thing as Wolfram rule numbering.

User avatar
Rhombic
Posts: 1072
Joined: June 1st, 2013, 5:41 pm

Re: The MAP syntax

Post by Rhombic » July 1st, 2017, 11:01 am

dvgrn wrote:
gameoflifemaniac wrote:How does the MAP syntax work?
This answer to a MAP-related question might also be useful to walk through. It's a little hard to wrap one's head around at first -- the position of each binary digit is itself a neighborhood pattern encoded in binary. Same kind of thing as Wolfram rule numbering.
In the same way, to make modifications yourself, choose a transition. Mine will be B7e(South).
101
101
111

which is in decimal 367 = 61*6+1
position 61 of the CGoL MAP is I (8 in decimal): 001000; add the 1 at position 1 = 011000 (decimal 24 --> base 64 is Y).
Switching at position 64 I for Y:

Code: Select all

x = 15, y = 15, rule = MAPARYXfhZofugWaH7oaIDogBZofuhogOiAaIDogIAAgAAWaH7oaIDogGiA6ICAAYAAaIDogIAAgACAAIAAAAAAAA
6b3o$6bobo$6bobo4$3o9b3o$o13bo$3o9b3o4$6bobo$6bobo$6b3o!
SoL : FreeElectronics : DeadlyEnemies : 6a-ite : Rule X3VI
what is “sesame oil”?

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: The MAP syntax

Post by gameoflifemaniac » July 2nd, 2017, 12:25 pm

Rhombic wrote:
dvgrn wrote:
gameoflifemaniac wrote:How does the MAP syntax work?
This answer to a MAP-related question might also be useful to walk through. It's a little hard to wrap one's head around at first -- the position of each binary digit is itself a neighborhood pattern encoded in binary. Same kind of thing as Wolfram rule numbering.
In the same way, to make modifications yourself, choose a transition. Mine will be B7e(South).
101
101
111

which is in decimal 367 = 61*6+1
position 61 of the CGoL MAP is I (8 in decimal): 001000; add the 1 at position 1 = 011000 (decimal 24 --> base 64 is Y).
Switching at position 64 I for Y:

Code: Select all

x = 15, y = 15, rule = MAPARYXfhZofugWaH7oaIDogBZofuhogOiAaIDogIAAgAAWaH7oaIDogGiA6ICAAYAAaIDogIAAgACAAIAAAAAAAA
6b3o$6bobo$6bobo4$3o9b3o$o13bo$3o9b3o4$6bobo$6bobo$6b3o!
Where does the 61 come from?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
gameoflifeboy
Posts: 474
Joined: January 15th, 2015, 2:08 am

Re: The MAP syntax

Post by gameoflifeboy » July 2nd, 2017, 10:45 pm

gameoflifemaniac wrote:Where does the 61 come from?
The transition B7e(south) is encoded by the binary number 101101111, found by reading across the rows of the 3 by 3 grid of cells. This number in decimal is 367, so we need to look at the 367th bit of the MAP rule string. Since each character in this string takes up 6 bits, we need to divide 367 by 6. 367/6 is 61 with a remainder of 1, so we look at the 61st character of the rule string. This character is 'I', which encodes the binary string 001000. The relevant bit here is the second digit, and it is 0 because B7e(south) is not part of the rule and thus the 3 by 3 configuration produces an off cell. To make the configuration produce an on cell instead, we need to change this 0 to a 1, which changes the binary string to 011000, encoded by 'Y'. Thus, changing the I at position 61 to a Y adds the B7e(south) transition to the rule.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: The MAP syntax

Post by gameoflifemaniac » July 3rd, 2017, 5:54 am

gameoflifeboy wrote:
gameoflifemaniac wrote:Where does the 61 come from?
The transition B7e(south) is encoded by the binary number 101101111, found by reading across the rows of the 3 by 3 grid of cells. This number in decimal is 367, so we need to look at the 367th bit of the MAP rule string. Since each character in this string takes up 6 bits, we need to divide 367 by 6. 367/6 is 61 with a remainder of 1, so we look at the 61st character of the rule string. This character is 'I', which encodes the binary string 001000. The relevant bit here is the second digit, and it is 0 because B7e(south) is not part of the rule and thus the 3 by 3 configuration produces an off cell. To make the configuration produce an on cell instead, we need to change this 0 to a 1, which changes the binary string to 011000, encoded by 'Y'. Thus, changing the I at position 61 to a Y adds the B7e(south) transition to the rule.
Thanks very much! So different characters in the same position can mean the same, right?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
dvgrn
Moderator
Posts: 10695
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: The MAP syntax

Post by dvgrn » July 3rd, 2017, 9:05 am

gameoflifemaniac wrote:Thanks very much! So different characters in the same position can mean the same, right?
If I'm understanding the question right, no. Any change to the MAP string will change what happens in one of the 512 possible neighborhoods.

Each character encodes six neighborhoods (because MAP strings use a base-64 code, and 64 = 2^6). So any valid change in a character will change one or more bits from 0 to 1, or 1 to 0. When Golly/LifeViewer sees the relevant neighborhood, it will set the state of the center cell differently depending on the new state of that bit.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: The MAP syntax

Post by gameoflifemaniac » July 4th, 2017, 5:19 am

What would be the syntax for Wolfram 22?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
dvgrn
Moderator
Posts: 10695
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: The MAP syntax

Post by dvgrn » July 4th, 2017, 4:12 pm

gameoflifemaniac wrote:What would be the syntax for Wolfram 22?
You can figure that out for yourself. Use Rhombic's script. Start with an all-OFF MAP string

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
(or the script gives you that by default if you enter an empty string).

You only need to change three transitions to get W22: if a single neighbor is ON to the NW, N, or NE then the center cell turns on.

So you flip the three bits 100000000, 010000000, and 001000000 with Rhombic's script, and you get

Code: Select all

x = 1, y = 1, rule = MAPAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
o!
#C [[ STOP 1023 THEME 8 AUTOSTART AUTOFIT HISTORYFIT THUMBNAIL THUMBSIZE 2 ]]
Of course with only three transitions, you're only going to have cells ON for one tick, so you have to use some kind of cell history to keep a record of what happened in the past. If you want cells to stay on once they turn on, use a different base MAP string. If I did it right,

AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//w

is equivalent to B/S012345678, which is a good place to start... Seems to work as a base to produce a staying-ON version of Wolfram Rule 22:

Code: Select all

x = 1, y = 1, rule = MAPAAD//wAA//+AAP//AAD//4AA//8AAP//AAD//wAA//+AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//w
o!
#C [[ STOP 1023 AUTOSTART AUTOFIT ]]

Post Reply