Page 1 of 1

The MAP Syntax

Posted: July 1st, 2017, 4:53 am
by gameoflifemaniac
How does the MAP syntax work?

Re: The MAP syntax

Posted: July 1st, 2017, 8:38 am
by Rhombic
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.

Re: The MAP syntax

Posted: July 1st, 2017, 9:14 am
by dvgrn
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.

Re: The MAP syntax

Posted: July 1st, 2017, 11:01 am
by Rhombic
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!

Re: The MAP syntax

Posted: July 2nd, 2017, 12:25 pm
by gameoflifemaniac
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?

Re: The MAP syntax

Posted: July 2nd, 2017, 10:45 pm
by gameoflifeboy
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.

Re: The MAP syntax

Posted: July 3rd, 2017, 5:54 am
by gameoflifemaniac
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?

Re: The MAP syntax

Posted: July 3rd, 2017, 9:05 am
by dvgrn
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.

Re: The MAP syntax

Posted: July 4th, 2017, 5:19 am
by gameoflifemaniac
What would be the syntax for Wolfram 22?

Re: The MAP syntax

Posted: July 4th, 2017, 4:12 pm
by dvgrn
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 ]]