Page 1 of 1

Universal Rule Table

Posted: November 5th, 2010, 6:42 pm
by ssaamm
Well, I think it's about time we brought together every format into an agreeable, deep, and effective rule table. It will be very difficult, but I have a list of all the things we need to specify in one of these tables. I believe the best way is XML, Like this:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<ruletable>
    <neighborhoods>
        <neighborhood name="moore_totalistic">
            <report id="1">
                <value>1+2+3+4+5+6+7+8</value>
                <neighbor id="1">
                    <x>0</x>
                    <y>1</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="2">
                    <x>1</x>
                    <y>1</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="3">
                    <x>1</x>
                    <y>0</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="4">
                    <x>1</x>
                    <y>-1</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="5">
                    <x>0</x>
                    <y>-1</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="6">
                    <x>-1</x>
                    <y>-1</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="7">
                    <x>-1</x>
                    <y>0</y>
                    <weight>1</weight>
                </neighbor>
                <neighbor id="8">
                    <x>-1</x>
                    <y>1</y>
                    <weight>1</weight>
                </neighbor>
            </report>
        </neighborhood>
    </neighborhoods>
    <rules>
        <variables>
            <variable name="a">
                <free>0</free>
                <states>0,1,4,5,6,7,8</states>
            </variable>
        </variables>
        <rule neighborhood="moore_totalistic">
            <from state="0">
                <to state="1">
                    <condition>3</condition>
                </to>
            </from>
            <from state="1">
                <to state="0">
                    <condition>a</condition>
                </to>
            </from>
        </rule>
    </rules>
</ruletable>
What do you think?

Re: Universal Rule Table

Posted: November 6th, 2010, 9:58 am
by ebcube
ssaamm wrote:Well, I think it's about time we brought together every format into an agreeable, deep, and effective rule table. It will be very difficult, but I have a list of all the things we need to specify in one of these tables. I believe the best way is XML, Like this:

What do you think?
There is absolutely no need for such a complex format. XML is not always the right way to do things. It's too bulky.

That said, we need an easier way to define complex ruletables. Maybe a RuleTree-like approach, but without having to create a RuleTree from it.

Re: Universal Rule Table

Posted: November 6th, 2010, 6:25 pm
by Tim Hutton
It would be nice to have one final format for all rules. Rule tables fill a niche but have shortcomings: many complex rules seem to be better expressed in high-level languages like Python, C++ and Java. (Golly supports Python rules (see make-ruletree.py) but only for rules with few enough states and neighbors that we can iterate over all input combinations.)

Before working on a new format though, be sure to check out existing ones like cellang and CDL, as listed here: http://code.google.com/p/ruletablerepos ... /TheFormat
Any new format would have to have some advantage over those.

Re: Universal Rule Table

Posted: November 6th, 2010, 9:22 pm
by ebcube
Tim Hutton wrote:(Golly supports Python rules (see make-ruletree.py) but only for rules with few enough states and neighbors that we can iterate over all input combinations.)
Exactly! Now, if we could just run the code directly, those limitations on states and neighbours would go away. Of course, letting anyone plug their own Python code into Golly is probably not a good idea.

Re: Universal Rule Table

Posted: November 6th, 2010, 9:41 pm
by ssaamm
Hmm...

Well, would there be a better way to incorporate custom neighborhoods based by state into the current rule table format?
Also, would it be possible to have the .colors file be part of the rule table?

Re: Universal Rule Table

Posted: November 8th, 2010, 1:54 am
by Keiji
ebcube wrote:
Tim Hutton wrote:(Golly supports Python rules (see make-ruletree.py) but only for rules with few enough states and neighbors that we can iterate over all input combinations.)
Exactly! Now, if we could just run the code directly, those limitations on states and neighbours would go away. Of course, letting anyone plug their own Python code into Golly is probably not a good idea.
Err, no. I don't believe that will help at all. No matter how the code is run it still has to be iterated over, running native code would only make it faster by some constant factor which would not be nearly enough.

Essentially, what we need is a cut-down scripting language which Golly can analytically compile into a ruletree.

Re: Universal Rule Table

Posted: November 8th, 2010, 7:15 pm
by ssaamm
sounds good to me, but how easy would this be to manipulate?
I know xml isn't very convenient...