I couldn't find a well-described way of notating 3-State Isotropic Not-Totalistic rules, so I made one myself.
---------------------------------------------------------------------
Transitions:
I lifted the notation describing transitions from here. To go over it:
BA... - conditions in which state a is born
BB... - conditions in which state b is born
TA... - conditions in which state a becomes state b
TB... - conditions in which state b becomes state a
SA... - conditions in which state a remains unchanged
SB... - conditions in which state b remains unchanged
BA and BB, TA and SA, and TB and SB can not have the same neighborhood configuration listed in both one and the other, as they contradict each other.
For all combinations of starting state and neighborhoods not specified in a rulestring, the cell will become state 0.
In the rulestring, they are listed as BA/BB/TA/TB/SA/SB.
---------------------------------------------------------------------
Neighborhood Configurations:
Neighborhood configurations are notated as such for a given neighborhood:
ns(ab)
Where n is the total number of live cells in a configuration, s is the hensel notation for the shape of the live cells (as in not distinguishing between the two live states) with the number excluded (the number for the shape is n), a is the hensel notation for the shape of the cells of state a (with the number included), and b is the hensel notation for the shape of the cells of state b (also with the number included).
In this, a and b can not have overlap and, when taken together, must have the shape of ns.
Take this example neighborhood where blue is state a, red is state b, and the dull yellow is the dead state.
In this notation, this neighborhood configuration is written as 2k(1e1c).
From here on out, I will be referring to the stuff in the parentheses as subconfigurations.
For any subconfigurations that map to the same configuration, they are listed consecutively after their respective configuration letter.
like this: s(ab)(ab)(ab)...
For configurations with the same number of live cells, they and their subconfigurations are listed consecutively after their respective number.
like this: ns(ab)s(ab)s(ab)...
If no subconfiguration is included after a configuration letter, it means that every subconfiguration for that configuration is included.
The same goes for number; if no configuration letter is listed after the number (or subconfiguration in the case of 8, as 8 no configuration letter in hensel notation), it means that every configuration for that number and every subconfiguration for each of those configurations are included.
---------------------------------------------------------------------
Edge Cases:
There are some complicating factors that need to be addressed.
Their are four combinations of configuration and subconfiguration that refer to two neighborhood configurations instead of one. In these cases, brackets containing either a 1 or a 2 are to be placed after the relevant subconfiguration.
Images of these neighborhood configurations, along with how they are notated:
Top: 5q(3q2e)[1]
Bottom: 5q(3q2e)[2]
Top: 5r(3r2c)[1]
Bottom: 5r(3r2c)[2]
Top: 6k(4k2k)[1]
Bottom: 6k(4k2k)[2]
Top: 6a(4a2a)[1]
Bottom: 6a(4a2a)[2]
There are also four combinations of configuration and subconfiguration in which a and b are identical, but you can't get the inverse of a neighborhood configuration (inverse meaning states a and b are switched) by any combination of rotation and reflection. To make it possible to distinguish between a neighborhood configuration and its inverse, a $ is to be placed after the appropriate configuration within the subconfiguration.
Images of these neighborhood configurations, along with how they are notated. Note that, for this set of images, the bottom neighborhood configuration is the inverse of the top:
Top: 4k(2k2k$)
Bottom: 4k(2k$2k)
Top: 4a(2a2a$)
Bottom: 4a(2a$2a)
Top: 6c(3r3r$)
Bottom: 6c(3r$3r)
Top: 6e(3q3q$)
Bottom: 6e(3q$3q)
---------------------------------------------------------------------
Here is an image of every possible neighborhood configuration (technically half; no inverses are included) in this rulespace, organized for use for this notation:
---------------------------------------------------------------------
As promised, I am also including a script for turning a rulestring for this notation into a rulefile:
Code: Select all
import string
import os
import golly
rulestring = golly.getstring("Input rulestring:")
longfilename = ""
for c in rulestring:
if c != "/":
longfilename = longfilename + c
else:
longfilename = longfilename + "_"
filename = longfilename[:150]
ruleStruct = [[0,["",["","",None,"00000000","00000000"]]],[1,["c",["1c","0",None,"00000001","00000002"]],["e",["1e","0",None,"00000010","00000020"]]],[2,["c",["2c","0",None,"00000101","00000202"],["1c","1c",None,"00000102","00000201"]],["e",["2e","0",None,"00001010","00002020"],["1e","1e",None,"00001020","00002010"]],["k",["2k","0",None,"00001001","00002002"],["1e","1c",None,"00001002","00002001"]],["a",["2a","0",None,"00000011","00000022"],["1e","1c",None,"00000012","00000021"]],["i",["2i","0",None,"00100010","00200020"],["1e","1e",None,"00100020","00200010"]],["n",["2n","0",None,"00010001","00020002"],["1c","1c",None,"00010002","00020001"]]],[3,["c",["3c","0",None,"00010101","00020202"],["2n","1c",None,"00010201","00020102"],["2c","1c",None,"00010102","00020201"]],["e",["3e","0",None,"00101010","00202020"],["2i","1c",None,"00102010","00201020"],["2e","1e",None,"00101020","00202010"]],["k",["3k","0",None,"00101001","00202002"],["2e","1c",None,"00101002","00202001"],["2k","1e",None,"00102001","00201002"]],["a",["3a","0",None,"00001110","00002220"],["2e","1c",None,"00001210","00002120"],["2a","1e",None,"00001120","00002210"]],["i",["3i","0",None,"00000111","00000222"],["2a","1c",None,"00000112","00000221"],["2c","1e",None,"00000121","00000212"]],["n",["3n","0",None,"00001101","00002202"],["2a","1c",None,"00001102","00002201"],["2k","1c",None,"00001201","00002102"],["2c","1e",None,"00002101","00001202"]],["y",["3y","0",None,"00100101","00200202"],["2k","1c",None,"00100102","00200201"],["2c","1e",None,"00200101","00100202"]],["q",["3q","0",None,"00010011","00020022"],["2a","1c",None,"00020011","00010022"],["2k","1c",None,"00010012","00020021"],["2n","1e",None,"00010021","00020012"]],["j",["3j","0",None,"00001011","00002022"],["2e","1c",None,"00001012","00002021"],["2a","1e",None,"00002011","00001022"],["2k","1e",None,"00001021","00002012"]],["r",["3r","0",None,"00100011","00200022"],["2i","1c",None,"00100012","00200021"],["2a","1e",None,"00200011","00100022"],["2k","1e",None,"00100021","00200012"]]],[4,["c",["4c","0",None,"01010101","02020202"],["3c","1c",None,"01010102","02020201"],["2c","2c",None,"01010202","02020101"],["2n","2n",None,"01020102","02010201"]],["e",["4e","0",None,"10101010","20202020"],["3e","1e",None,"10101020","20202010"],["2e","2e",None,"10102020","20201010"],["2i","2i",None,"10201020","20102010"]],["k",["4k","0",None,"00101101","00202202"],["3j","1c",None,"00101102","00202201"],["3k","1c",None,"00101201","00202102"],["3y","1e",None,"00102101","00201202"],["3n","1e",None,"00201101","00102202"],["2e","2c",None,"00101202","00202101"],["2k","2k$",None,"00102102","00201201"],["2k","2a",None,"00102201","00201102"]],["a",["4a","0",None,"00001111","00002222"],["3j","1c",None,"00001211","00002122"],["3a","1c",None,"00001112","00002221"],["3n","1e",None,"00001121","00002212"],["3i","1e",None,"00002111","00001222"],["2e","2c",None,"00001212","00002121"],["2a","2a$",None,"00001122","00002211"],["2k","2a",None,"00001221","00002112"]],["i",["4i","0",None,"00110110","00220220"],["3r","1c",None,"00110210","00220120"],["3n","1e",None,"00110120","00220210"],["2i","2c",None,"00120210","00210120"],["2k","2k",None,"00120120","00210210"],["2a","2a",None,"00110220","00220110"]],["n",["4n","0",None,"00010111","00020222"],["3q","1c",None,"00010211","00020122"],["3n","1c",None,"00010112","00020221"],["3i","1c",None,"00020111","00010222"],["3c","1e",None,"00010121","00020212"],["2k","2c",None,"00010212","00020121"],["2n","2a",None,"00010221","00020112"],["2c","2a",None,"00010122","00020211"]],["y",["4y","0",None,"00110101","00220202"],["3q","1c",None,"00110201","00220102"],["3y","1c",None,"00120101","00210202"],["3n","1c",None,"00110102","00220201"],["3c","1e",None,"00210101","00120202"],["2a","2c",None,"00110202","00220101"],["2k","2c",None,"00120201","00210102"],["2k","2n",None,"00120102","00210201"]],["q",["4q","0",None,"00111001","00222002"],["3a","1c",None,"00111002","00222001"],["3k","1c",None,"00121001","00212002"],["3q","1e",None,"00112001","00221002"],["2a","2k",None,"00112002","00221001"],["2e","2n",None,"00121002","00212001"]],["j",["4j","0",None,"00101011","00202022"],["3e","1c",None,"00101012","00202021"],["3r","1e",None,"00102011","00201022"],["3j","1e",None,"00201011","00102022"],["3k","1e",None,"00101021","00202012"],["2k","2e",None,"00102021","00201012"],["2i","2k",None,"00102012","00201021"],["2e","2a",None,"00101022","00202011"]],["r",["4r","0",None,"00101110","00202220"],["3e","1c",None,"00101210","00202120"],["3r","1e",None,"00102110","00201220"],["3j","1e",None,"00101120","00202210"],["3a","1e",None,"00201110","00102220"],["2k","2e",None,"00102120","00201210"],["2i","2a",None,"00102210","00201120"],["2e","2a",None,"00101220","00202110"]],["t",["4t","0",None,"00100111","00200222"],["3r","1c",None,"00100112","00200221"],["3y","1e",None,"00100121","00200212"],["3i","1e",None,"00200111","00100222"],["2i","2c",None,"00100212","00200121"],["2k","2a",None,"00100122","00200211"]],["w",["4w","0",None,"00011011","00022022"],["3j","1c",None,"00011012","00022021"],["3q","1e",None,"00011021","00022012"],["2n","2e",None,"00012021","00021012"],["2k","2k",None,"00012012","00021021"],["2a","2a",None,"00011022","00022011"]],["z",["4z","0",None,"00110011","00220022"],["3r","1c",None,"00110012","00220021"],["3q","1e",None,"00110021","00220012"],["2k","2k",None,"00120021","00210012"],["2a","2a",None,"00110022","00220011"],["2i","2n",None,"00120012","00210021"]]],[5,["c",["5c","0",None,"10101011","20202022"],["4e","1c",None,"10101012","20202021"],["4r","1e",None,"10102011","20201022"],["4j","1e",None,"10101021","20202012"],["3j","2e",None,"10102021","20201012"],["3a","2e",None,"10202011","20101022"],["3k","2e",None,"20101021","10202012"],["3e","2k",None,"10102012","20201021"],["3e","2a",None,"10101022","20202011"],["3r","2i",None,"10201021","20102012"]],["e",["5e","0",None,"01010111","02020222"],["4y","1c",None,"01010112","02020221"],["4n","1c",None,"02010111","01020222"],["4c","1e",None,"01010121","02020212"],["3y","2c",None,"01010212","02020121"],["3n","2c",None,"02010112","01020221"],["3i","2c",None,"02020111","01010222"],["3c","2k",None,"02010121","01020212"],["3c","2a",None,"01010122","02020211"],["3q","2n",None,"01020112","02010221"]],["k",["5k","0",None,"01011011","02022022"],["4w","1c",None,"02011011","01022022"],["4k","1c",None,"01011012","02022021"],["4y","1e",None,"01011021","02022012"],["3j","2c",None,"02021011","01012022"],["3c","2e",None,"01012021","02021012"],["3q","2k",None,"02012011","01021022"],["3y","2k",None,"01012012","02021021"],["3n","2a",None,"01011022","02022011"],["3k","2n",None,"01021012","02012021"]],["a",["5a","0",None,"00011111","00022222"],["4w","1c",None,"00011211","00022122"],["4a","1c",None,"00011112","00022221"],["4n","1e",None,"00011121","00022212"],["3j","2c",None,"00011212","00022121"],["3c","2e",None,"00012121","00021212"],["3n","2k",None,"00012112","00021221"],["3q","2a",None,"00011221","00022112"],["3i","2a",None,"00011122","00022211"],["3a","2n",None,"00021112","00012221"]],["i",["5i","0",None,"00111110","00222220"],["4r","1c",None,"00111210","00222120"],["4i","1e",None,"00112110","00221220"],["4a","1e",None,"00111120","00222210"],["3e","2c",None,"00121210","00212120"],["3n","2e",None,"00112120","00221210"],["3j","2k",None,"00121120","00212210"],["3r","2a",None,"00112210","00221120"],["3a","2a",None,"00111220","00222110"],["3i","2i",None,"00211120","00122210"]],["n",["5n","0",None,"00101111","00202222"],["4r","1c",None,"00101112","00202221"],["4j","1c",None,"00101211","00202122"],["4t","1e",None,"00102111","00201222"],["4a","1e",None,"00201111","00102222"],["4k","1e",None,"00101121","00202212"],["3e","2c",None,"00101212","00202121"],["3y","2e",None,"00102121","00201212"],["3i","2e",None,"00202111","00101222"],["3r","2k",None,"00102112","00201221"],["3j","2k",None,"00201211","00102122"],["3a","2k",None,"00201112","00102221"],["3r","2a",None,"00102211","00201122"],["3j","2a",None,"00101122","00202211"],["3k","2a",None,"00101221","00202112"],["3n","2i",None,"00201121","00102212"]],["y",["5y","0",None,"01101011","02202022"],["4j","1c",None,"01101012","02202021"],["4i","1e",None,"01102011","02201022"],["4k","1e",None,"01101021","02202012"],["3e","2c",None,"02101012","01202021"],["3n","2e",None,"01102021","02201012"],["3r","2k",None,"01102012","02201021"],["3k","2k",None,"01201012","02102021"],["3j","2a",None,"01101022","02202011"],["3y","2i",None,"01201021","02102012"]],["q",["5q","0",None,"00111011","00222022"],["4r","1c",None,"00111012","00222021"],["4j","1c",None,"00121011","00212022"],["4z","1e",None,"00112011","00221022"],["4w","1e",None,"00211011","00122022"],["4q","1e",None,"00111021","00222012"],["3q","2e",1,"00112021","00221012"],["3q","2e",2,"00212011","00121022"],["3r","2k",None,"00112012","00221021"],["3j","2k",None,"00211012","00122021"],["3k","2k",None,"00121021","00212012"],["3r","2a",None,"00122011","00211022"],["3j","2a",None,"00221011","00112022"],["3a","2a",None,"00111022","00222011"],["3q","2i",None,"00211021","00122012"],["3e","2n",None,"00121012","00212021"]],["j",["5j","0",None,"00111101","00222202"],["4q","1c",None,"00111201","00222102"],["4a","1c",None,"00111102","00222201"],["4k","1c",None,"00121101","00212202"],["4y","1e",None,"00112101","00221202"],["4n","1e",None,"00211101","00122202"],["3a","2c",None,"00111202","00222101"],["3k","2c",None,"00121201","00212102"],["3c","2e",None,"00212101","00121202"],["3q","2k",None,"00211201","00122102"],["3n","2k",None,"00112102","00221201"],["3i","2k",None,"00211102","00122201"],["3q","2a",None,"00112201","00221102"],["3y","2a",None,"00122101","00211202"],["3n","2a",None,"00221101","00112202"],["3j","2n",None,"00121102","00212201"]],["r",["5r","0",None,"00110111","00220222"],["4z","1c",None,"00110211","00220122"],["4t","1c",None,"00120111","00210222"],["4i","1c",None,"00110112","00220221"],["4y","1e",None,"00110121","00220212"],["4n","1e",None,"00210111","00120222"],["3r","2c",1,"00110212","00220121"],["3r","2c",2,"00120211","00210122"],["3q","2k",None,"00210211","00120122"],["3y","2k",None,"00120121","00210212"],["3n","2k",None,"00210112","00120221"],["3q","2a",None,"00110221","00220112"],["3n","2a",None,"00110122","00220211"],["3i","2a",None,"00220111","00110222"],["3c","2i",None,"00210121","00120212"],["3r","2n",None,"00120112","00210221"]]],[6,["c",["6c","0",None,"10101111","20202222"],["5c","1c",None,"10101112","20202221"],["5y","1e",None,"10101121","20202212"],["5n","1e",None,"10102111","20201222"],["5i","1e",None,"10201111","20102222"],["4e","2c",None,"10101212","20202121"],["4a","2e",None,"20201111","10102222"],["4k","2e",None,"10102121","20201212"],["4r","2k",None,"10201112","20102221"],["4j","2k",None,"10102112","20201221"],["4r","2a",None,"10102211","20201122"],["4j","2a",None,"10101122","20202211"],["4t","2i",None,"20102111","10201222"],["4i","2i",None,"10201121","20102212"],["3j","3a",None,"10102221","20201112"],["3e","3i",None,"10101222","20202111"],["3e","3n",None,"10102212","20201121"],["3e","3y",None,"10201212","20102121"],["3k","3j",None,"10102122","20201211"],["3r","3r$",None,"10201122","20102211"]],["e",["6e","0",None,"01011111","02022222"],["5j","1c",None,"01011112","02022221"],["5a","1c",None,"02011111","01022222"],["5k","1c",None,"01011211","02022122"],["5e","1e",None,"01011121","02022212"],["4a","2c",None,"02021111","01012222"],["4k","2c",None,"01011212","02022121"],["4c","2e",None,"01012121","02021212"],["4y","2k",None,"01012112","02021221"],["4n","2k",None,"02012111","01021222"],["4y","2a",None,"01011221","02022112"],["4n","2a",None,"01011122","02022211"],["4w","2n",None,"02011211","01022122"],["4q","2n",None,"01021112","02012221"],["3k","3c",None,"01021212","02012121"],["3c","3a",None,"01012221","02021112"],["3n","3i",None,"01011222","02022111"],["3y","3n",None,"01012212","02021121"],["3q","3q$",None,"01021122","02012211"],["3c","3j",None,"01012122","02021211"]],["k",["6k","0",None,"01101111","02202222"],["5q","1c",None,"01101112","02202221"],["5y","1c",None,"01101211","02202122"],["5n","1c",None,"02101111","01202222"],["5r","1e",None,"01102111","02201222"],["5j","1e",None,"01201111","02102222"],["5k","1e",None,"01101121","02202212"],["4r","2c",None,"02101112","01202221"],["4j","2c",None,"01101212","02202121"],["4y","2e",None,"01102121","02201212"],["4n","2e",None,"01202111","02101222"],["4z","2k",None,"01102112","02201221"],["4t","2k",None,"02102111","01201222"],["4q","2k",None,"01201112","02102221"],["4k","2k",1,"01201211","02102122"],["4k","2k",2,"02101121","01202212"],["4w","2a",None,"01101122","02202211"],["4i","2a",None,"01102211","02201122"],["4a","2a",None,"02201111","01102222"],["4k","2a",None,"01101221","02202112"],["4y","2i",None,"01201121","02102212"],["4j","2n",None,"02101211","01202122"],["3c","3e",None,"01202121","02101212"],["3q","3k",None,"01202112","02101221"],["3n","3a",None,"01102221","02201112"],["3j","3i",None,"01101222","02202111"],["3r","3n",None,"01102212","02201121"],["3k","3y",None,"01201212","02102121"],["3r","3q",None,"02102211","01201122"],["3q","3j",None,"01102122","02201211"],["3n","3j",None,"01202211","02101122"],["3y","3r",None,"01201221","02102112"]],["a",["6a","0",None,"00111111","00222222"],["5q","1c",None,"00111211","00222122"],["5n","1c",None,"00121111","00212222"],["5i","1c",None,"00111112","00222221"],["5r","1e",None,"00112111","00221222"],["5j","1e",None,"00111121","00222212"],["5a","1e",None,"00211111","00122222"],["4r","2c",None,"00111212","00222121"],["4j","2c",None,"00121211","00212122"],["4y","2e",None,"00112121","00221212"],["4n","2e",None,"00212111","00121222"],["4w","2k",None,"00211211","00122122"],["4i","2k",None,"00112112","00221221"],["4a","2k",None,"00211112","00122221"],["4k","2k",None,"00121121","00212212"],["4z","2a",None,"00112211","00221122"],["4t","2a",None,"00122111","00211222"],["4q","2a",None,"00111221","00222112"],["4a","2a",1,"00111122","00222211"],["4a","2a",2,"00221111","00112222"],["4n","2i",None,"00211121","00122212"],["4r","2n",None,"00121112","00212221"],["3e","3c",None,"00121212","00212121"],["3q","3a",None,"00112221","00221112"],["3r","3i",None,"00122211","00211122"],["3a","3i",None,"00111222","00222111"],["3r","3n",None,"00112212","00221121"],["3k","3n",None,"00121221","00212112"],["3r","3q",None,"00122112","00211221"],["3j","3q",None,"00121122","00212211"],["3y","3j",None,"00122121","00211212"],["3n","3j",None,"00112122","00221211"]],["i",["6i","0",None,"01110111","02220222"],["5r","1c",None,"01110112","02220221"],["5e","1e",None,"01110121","02220212"],["4t","2c",None,"01110212","02220121"],["4i","2c",None,"01120211","02210122"],["4y","2k",None,"01120121","02210212"],["4n","2a",None,"01110122","02220211"],["4c","2i",None,"01210121","02120212"],["4z","2n",None,"01120112","02210221"],["3r","3c",None,"01120212","02210121"],["3i","3i",None,"01110222","02220111"],["3n","3n",None,"01120221","02210112"],["3y","3y",None,"01210212","02120121"],["3q","3q",None,"01120122","02210211"]],["n",["6n","0",None,"10111011","20222022"],["5c","1c",None,"10111012","20222021"],["5q","1e",None,"10111021","20222012"],["4w","2e",None,"10112021","20221012"],["4q","2e",None,"10212011","20121022"],["4j","2k",None,"10112012","20221021"],["4r","2a",None,"10111022","20222011"],["4z","2i",None,"10211021","20122012"],["4e","2n",None,"10121012","20212021"],["3q","3q",None,"10212012","20121021"],["3a","3a",None,"10222011","20111022"],["3e","3q",None,"10121022","20212011"],["3j","3j",None,"10112022","20221011"],["3r","3r",None,"10211022","20122011"]]],[7,["c",["7c","0",None,"10111111","20222222"],["6n","1c",None,"10111211","20222122"],["6c","1c",None,"10111112","20222221"],["6a","1e",None,"10211111","20122222"],["6k","1e",None,"10111121","20222212"],["5c","2c",None,"10111212","20222121"],["5j","2e",None,"10212111","20121222"],["5a","2e",None,"20211111","10122222"],["5k","2e",None,"10112121","20221212"],["5q","2k",None,"10211211","20122122"],["5y","2k",None,"10112112","20221221"],["5n","2k",None,"10211112","20122221"],["5q","2a",None,"10111221","20222112"],["5n","2a",None,"10111122","20222211"],["5i","2a",None,"10221111","20112222"],["5r","2i",None,"10211121","20122212"],["5c","2n",None,"10121112","20212221"],["4e","3c",None,"10121212","20212121"],["4y","3e",None,"10212121","20121212"],["4n","3e",None,"20212111","10121222"],["4w","3k",None,"20211211","10122122"],["4k","3k",None,"10212112","20121221"],["4w","3a",None,"10112221","20221112"],["4a","3a",None,"10222111","20111222"],["4r","3i",None,"10111222","20222111"],["4r","3n",None,"10221211","20112122"],["4j","3n",None,"10112212","20221121"],["4j","3y",None,"10211212","20122121"],["4r","3q",None,"20121112","10212221"],["4j","3q",None,"10121122","20212211"],["4q","3j",None,"10212211","20121122"],["4a","3j",None,"20221111","10112222"],["4k","3j",None,"10112122","20221211"],["4z","3r",None,"10211221","20122112"],["4t","3r",None,"10211122","20122211"],["4i","3r",None,"10221121","20112212"]],["e",["7e","0",None,"01111111","02222222"],["6a","1c",None,"01111112","02222221"],["6k","1c",None,"01111211","02222122"],["6i","1e",None,"01112111","02221222"],["6e","1e",None,"01111121","02222212"],["5y","2c",None,"01121211","02212122"],["5n","2c",None,"01111212","02222121"],["5i","2c",None,"02111112","01222221"],["5e","2e",None,"01112121","02221212"],["5r","2k",None,"01112112","02221221"],["5j","2k",None,"01211112","02122221"],["5k","2k",None,"01121121","02212212"],["5r","2a",None,"01112211","02221122"],["5j","2a",None,"01111221","02222112"],["5a","2a",None,"01111122","02222211"],["5e","2i",None,"01211121","02122212"],["5q","2n",None,"01121112","02212221"],["4r","3c",None,"02121112","01212221"],["4j","3c",None,"01121212","02212121"],["4c","3e",None,"01212121","02121212"],["4y","3k",None,"01212112","02121221"],["4n","3a",None,"01112221","02221112"],["4i","3i",None,"01122211","02211122"],["4a","3i",None,"01111222","02222111"],["4t","3n",None,"01112212","02221121"],["4a","3n",None,"02211112","01122221"],["4k","3n",None,"01121221","02212112"],["4i","3y",None,"02112112","01221221"],["4k","3y",None,"01211212","02122121"],["4z","3q",None,"01122112","02211221"],["4w","3q",None,"01121122","02212211"],["4q","3q",None,"01221112","02112221"],["4y","3j",None,"01122121","02211212"],["4n","3j",None,"01112122","02221211"],["4y","3r",None,"01211221","02122112"],["4n","3r",None,"02211121","01122212"]]],[8,["",["8","0",None,"11111111","22222222"],["7c","1c",None,"11111112","22222221"],["7e","1e",None,"11111121","22222212"],["6c","2c",None,"11111212","22222121"],["6e","2e",None,"11112121","22221212"],["6k","2k",None,"11112112","22221221"],["6a","2a",None,"11111122","22222211"],["6i","2i",None,"11211121","22122212"],["6n","2n",None,"11121112","22212221"],["5c","3c",None,"11121212","22212121"],["5e","3e",None,"11212121","22121212"],["5k","3k",None,"11212112","22121221"],["5a","3a",None,"11112221","22221112"],["5i","3i",None,"11111222","22222111"],["5n","3n",None,"11112212","22221121"],["5y","3y",None,"11211212","22122121"],["5q","3q",None,"11121122","22212211"],["5j","3j",None,"11112122","22221211"],["5r","3r",None,"11211122","22122211"],["4e","4c",None,"12121212","21212121"],["4k","4k",None,"11212212","22121121"],["4a","4a",None,"11112222","22221111"],["4r","4n",None,"11121222","22212111"],["4y","4j",None,"11212122","22121211"],["4i","4t",None,"11211222","22122111"],["4q","4w",None,"11122122","22211211"],["4z","4z",None,"11221122","22112211"]]]]
top = "@RULE " + filename
header = "\n\n@TABLE\nn_states:3\nneighborhood:Moore\nsymmetries:rotate4reflect\n\nvar a={0,1,2}\nvar ab={0,1,2}\nvar ac={0,1,2}\nvar ad={0,1,2}\nvar ae={0,1,2}\nvar af={0,1,2}\nvar ag={0,1,2}\nvar ah={0,1,2}\nvar ai={0,1,2}\n"
body = "\n"
tail = rulestring
currentNum = ""
currentConfig = ""
currentSubconfig = ""
currentPos = 0
currentBeginEnd = [0,1]
isInSubconfig = False
getFullNumList = False
getFullConfigList = False
charlist = ["c","e","k","a","i","n","y","q","j","r","t","w","z"]
for c in rulestring:
if c == "(" or c == "[":
isInSubconfig = True
if c == ")" or c == "]":
isInSubconfig = False
if isInSubconfig and c != "(":
currentPos = currentPos + 1
continue
#note: am planning on detecting subconfig on "(" and getting the
#numstring for it on ")"
if c == "A" or c == "B" or c == "T" or c == "S":
currentPos = currentPos + 1
continue
for n in [0,1,2,3,4,5,6,7,8]:
if c == str(n):
currentNum = n
if currentPos + 1 < len(rulestring):
if rulestring[currentPos+1] == str(n+1) or rulestring[currentPos+1] == "/":
getFullNumList = True
else:
getFullNumList = False
else:
getFullNumList = True
for k in charlist:
if c == k:
currentConfig = c
if currentPos + 1 < len(rulestring):
if rulestring[currentPos+1] != "(":
getFullConfigList = True
else:
getFullConfigList = False
else:
getFullConfigList = True
if c == "(":
currentSubconfig = rulestring[currentPos+1:rulestring.find(")",currentPos)]
if rulestring[rulestring.find(")",currentPos)+1:rulestring.find(")",currentPos)+2] == "[":
currentVariant = int(rulestring[rulestring.find("[",currentPos)+1:rulestring.find("[",currentPos)+2])
else:
currentVariant = None
if c == "/":
if rulestring[currentPos:currentPos+3] == "/BB":
currentBeginEnd = [0,2]
if rulestring[currentPos:currentPos+3] == "/TA":
currentBeginEnd = [1,2]
if rulestring[currentPos:currentPos+3] == "/TB":
currentBeginEnd = [2,1]
if rulestring[currentPos:currentPos+3] == "/SA":
currentBeginEnd = [1,1]
if rulestring[currentPos:currentPos+3] == "/SB":
currentBeginEnd = [2,2]
if getFullNumList:
for numbers in ruleStruct:
if numbers[0] == currentNum:
for configs in numbers:
if isinstance(configs,int):
continue
for subconfigs in configs:
if isinstance(subconfigs,str):
continue
body = body + str(currentBeginEnd[0]) + ","
for ch in subconfigs[3]:
body = body + ch + ","
body = body + str(currentBeginEnd[1]) + "\n"
if subconfigs[0] != subconfigs[1]:
body = body + str(currentBeginEnd[0]) + ","
for ch in subconfigs[4]:
body = body + ch + ","
body = body + str(currentBeginEnd[1]) + "\n"
if getFullConfigList:
for numbers in ruleStruct:
if numbers[0] == currentNum:
for configs in numbers:
if isinstance(configs,int):
continue
if configs[0] == currentConfig:
for subconfigs in configs:
if isinstance(subconfigs,str):
continue
body = body + str(currentBeginEnd[0]) + ","
for ch in subconfigs[3]:
body = body + ch + ","
body = body + str(currentBeginEnd[1]) + "\n"
if subconfigs[0] != subconfigs[1]:
body = body + str(currentBeginEnd[0]) + ","
for ch in subconfigs[4]:
body = body + ch + ","
body = body + str(currentBeginEnd[1]) + "\n"
if c == ")":
for numbers in ruleStruct:
if numbers[0] == currentNum:
for configs in numbers:
if isinstance(configs,int):
continue
if configs[0] == currentConfig:
for subconfigs in configs:
if isinstance(subconfigs,str):
continue
if currentSubconfig == subconfigs[0] + subconfigs[1]and currentVariant == subconfigs[2]:
body = body + str(currentBeginEnd[0]) + ","
for ch in subconfigs[3]:
body = body + ch + ","
body = body + str(currentBeginEnd[1]) + "\n"
elif currentSubconfig == subconfigs[1] + subconfigs[0]and currentVariant == subconfigs[2]:
body = body + str(currentBeginEnd[0]) + ","
for ch in subconfigs[4]:
body = body + ch + ","
body = body + str(currentBeginEnd[1]) + "\n"
getFullNumList = False
getFullConfigList = False
currentPos = currentPos + 1
body = body + "a,ab,ac,ad,ae,af,ag,ah,ai,0\n"
numlines = len(rulestring) // 999 + 1
filestring = top + header + body
for x in range(numlines):
filestring = filestring + "#" + tail[900*x:900*(x+1)] +"\n"
f = open(golly.getdir("rules") + filename + ".rule","w")
f.write(filestring)
f.close()
golly.setrule(filename)
Just open the script with golly and input your rulestring into the popup and you will have your rulefile!
I also created a rule generator for this notation, which is here.