Reversible Rule Generator
Reversible Rule Generator
I want a code that translates any binary rule table into one using the second-order method. Essentially you calculate what the rule WOULD produce at a certain location, and xor it with the previous state of that cells. Of course Golly doesn't allow you to go two steps back in time, but we can store that information by creating two extra states. That way any binary rule (Just Friends, Life, Callahan's Hexagons) could be made reversible (though without the same behavior).
Re: Reversible Rule Generator
Could you give an example?twinb7 wrote:Essentially you calculate what the rule WOULD produce at a certain location, and xor it with the previous state of that cells.
Ivan Fomichev
Re: Reversible Rule Generator
Awhile back, I posted a script that converts the three examples you gave (Life, Just Friends, and Callahan's non-totalistic hex rule), but it doesn't convert any arbitrary rule table. It only converts rules that can be expressed in totalistic B/S notation or Hensel's non-totalistic notation. See viewtopic.php?f=11&t=1293&hilit=reversi ... =75#p11153
Re: Reversible Rule Generator
With the second-order method we use the following state numbering to denote the current and previous state of the cell. To clarify, 'Golly State' will be the state golly uses, while 'state' will refer to the true state of the cell.codeholic wrote:Could you give an example?twinb7 wrote:Essentially you calculate what the rule WOULD produce at a certain location, and xor it with the previous state of that cells.
Code: Select all
Golly State | Previous State | Current State
0 0 0
1 0 1
2 1 0
3 1 1
To put it simply and ignore the actual theory behind it:
Given a binary rule table, do the following.
1. Treat cells 0 and 2 as off and 1 and 3 as on.
2. Under survival conditions of the original table, 1 -> 3 and 3 -> 2.
3. Under birth conditions of the original table, 0 -> 1 and 2 ->0.
4. Under death conditions of the original table, 1->2, 3->3.
5. Under 'no birth' conditions of the original table, 0->0 and 2->1.
I'll post an example rule table.
Re: Reversible Rule Generator
Code: Select all
@RULE ReversibleLife
@TABLE
n_states:4
neighborhood:Moore
symmetries:permute
#These states are treated as ‘on’.
var on_a = {1,3}
var on_b = {1,3}
var on_c = {1,3}
var on_d = {1,3}
#These states are treated as ‘off’.
var of_a = {0,2}
var of_b = {0,2}
var of_c = {0,2}
var of_d = {0,2}
var of_e = {0,2}
#These states indicate ‘any’.
var an_a = {0,1,2,3}
var an_b = {0,1,2,3}
var an_c = {0,1,2,3}
var an_d = {0,1,2,3}
var an_e = {0,1,2,3}
var an_f = {0,1,2,3}
var an_g = {0,1,2,3}
var an_h = {0,1,2,3}
#The birth rule: B3. Note that two states are considered as off: 0 and 2.
0,on_a,on_b,on_c,of_a,of_b,of_c,of_d,of_e,1
2,on_a,on_b,on_c,of_a,of_b,of_c,of_d,of_e,0
#The survival rule: S23. Note that two states are considered as on: 1 and 3.
1,on_a,on_b,an_a,of_a,of_b,of_c,of_d,of_e,3
3,on_a,on_b,an_a,of_a,of_b,of_c,of_d,of_e,2
#The scenario in which a cell dies, or a dead cell continues to be dead.
1,an_a,an_b,an_c,an_d,an_e,an_f,an_g,an_h,2
2,an_a,an_b,an_c,an_d,an_e,an_f,an_g,an_h,1
3,an_a,an_b,an_c,an_d,an_e,an_f,an_g,an_h,3
#The final line can be omitted as, in unspecified situations, Golly retains cell state.