Changing rulesets

coppro
2007-02-27
2013-06-05
  • coppro
    coppro
    2007-02-27

    Is there any way to modify the ruleset, or is that impossible?

     
    • Jafet
      Jafet
      2007-03-04

      Go to the menu bar and select Control -> Rule.

       
    • Ethan Wilson
      Ethan Wilson
      2007-12-15

      Any way to programmatically change the ruleset, based on conditions in one or more layers?

       
      • Dave Greene
        Dave Greene
        2007-12-15

        In a Python or Perl script, setrule() and g_setrule() respectively will accept rule strings of the form Bnnn/Snnn .

        If you're evolving the contents of a layer and want to change the rule if the population hits a certain threshold (just for example -- I'm having a hard time coming up with a scenario where changing the rule in midstream makes very much sense) you'll need to handle running the layer from inside the script, so you can monitor the layer's contents and react with a call to setrule() when necessary.

        If you need a sample, heisenburp.py does something like this.  getkey() can let you monitor user input from the keyboard, and dokey() will pass it on for Golly to handle.  Except speed changes don't have any effect inside a script -- run() always just goes as fast as possible, so you might have to deliberately stop and display results at intervals, as heisenburp.py does.

        Keep the cheer,

        Dave Greene

         
    • Ethan Wilson
      Ethan Wilson
      2007-12-18

      Hi Dave,

      Thanks for your informative response!  It is nice to know that programmatical changes to the ruleset can be done, however is that a global ruleset change, or can it be specified for a specified region of the cell space, or better yet, for each individual cell?  Just wondering.  Thanks!

      Merry Christmas!

      --- DanekJovax

       
      • Dave Greene
        Dave Greene
        2007-12-19

        > ...is that a global ruleset change, or can it be specified for a specified region of
        > the cell space, or better yet, for each individual cell?

        It's global.  That is, you can set a different rule for each layer, up to ten layers, but each layer is a separate universe where the rule is the same everywhere -- no mixing and matching.  Most of Golly's speedup shortcuts would fail to work if arbitrary cells or groups of cells were allowed to follow different rules.

        However, I suppose it would be possible to keep lists of rectangles that follow different rules, in a Golly script, and then ask Golly to run each rectangle (plus a one-cell boundary around the edge, which you would discard afterwards) and combine the results to build successive generations, one tick at a time.  Could be tricky to set up starting states, though -- a different stacked layer for each rule, maybe.  Except I think you'd need two layers per rule, with one layer being a "mask" pattern to show which cells Golly should apply that rule to.

        Keep the cheer,

        Dave

         
    • Ethan Wilson
      Ethan Wilson
      2007-12-19

      Thanks, Dave.  Yeah, there's an automata model that's in my head that's requiring cell-specific ruleset information, and given the internals you've described in golly, making these ruleset changes at that level would majorly bork golly's optimization algorithms.  I may have to grab a copy of the golly source and see what I can do with implementing my algorithm from within the current golly constructs.  I'd think it's possible, but it will likely require reworking the core iteration engine and tweaking the hasher, to allow the new cell STRUCT data to be included in hashing calculations.

      I'm sure you're wondering what in the world will this all result in... I'm still wondering myself. ;2)