Rule Golf

A forum where anything goes. Introduce yourselves to other members of the forums, discuss how your name evolves when written out in the Game of Life, or just tell us how you found it. This is the forum for "non-academic" content.
Post Reply
AforAmpere
Posts: 1334
Joined: July 1st, 2016, 3:58 pm

Rule Golf

Post by AforAmpere » July 21st, 2018, 7:57 pm

Here's another game to add to the list, which is about making rules. The game is like Code Golf, but with ruletables. The goal is to make a non-symmetric, Moore neighborhood rule table with any amount of states that exhibits some property while using the least number of transitions as possible. Variables are not allowed. If variables are used, it counts for all possible values of those variables. Your score is determined by the number of transitions used. The goal is to get the lowest score possible.

As a small example, given the goal of having a C orthogonal ship, this is the smallest transition table possible that has a pattern with that property, with only 2 transitions, giving me a score of 2:

Code: Select all

@RULE Example

@TABLE

n_states:2
neighborhood:Moore
symmetries:none

0,1,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0
Obviously, that is a very mundane challenge, but many possibilities are open. For instance, what is the least number of transitions to create a rule with a universal computer? Pose challenges below, and hopefully people will try and solve them.
I manage the 5S project, which collects all known spaceship speeds in Isotropic Non-totalistic rules. I also wrote EPE, a tool for searching in the INT rulespace.

Things to work on:
- Find (7,1)c/8 and 9c/10 ships in non-B0 INT.
- EPE improvements.

User avatar
Redstoneboi
Posts: 429
Joined: May 14th, 2018, 3:57 am

Re: Rule Golf

Post by Redstoneboi » July 21st, 2018, 11:16 pm

can we use different neighborhoods and instead count the score as the number of values written?
anyway here's my TC rule :P

Code: Select all

@RULE W110
@TABLE
n_states:2
neighborhood:oneDimensional
symmetries:none
0011
0111
1110
c(>^w^<c)~*
This is 「Fluffy」
「Fluffy」is my sutando.
「Fluffy」has the ability to engineer r e p l i c a t o r s.
「Fluffy」likes to watch spaceship guns in Golly.
「Fluffy」knows Natsuki best girl.

User avatar
blah
Posts: 311
Joined: April 9th, 2016, 7:22 pm

Re: Rule Golf

Post by blah » July 22nd, 2018, 11:10 am

What about normal style code golf? Here's my golfed version of your rule (78 bytes):

Code: Select all

@RULE 
@TABLE
n_states:2
neighborhood:vonNeumann
symmetries:none
010001
100000
Or this, with the same amount of bytes:

Code: Select all

@RULE 
@TABLE
n_states:2
neighborhood:oneDimensional
symmetries:none
0101
1000
(When I copy and paste the content of those code boxes into Golly, it doesn't work, but when I paste it from my text editor it does. I think that's because of the space at the end of the @RULE line being removed.)

@RULE
The file must contain an @RULE section[1]. In fact, it seems that golly doesn't just check that the line begins with "@RULE", it checks to see if it begins with "@RULE ", including a space at the end; otherwise it claims the rule contains no @RULE line, or if it is being pasted from the clipboard, it will simply treat it as random data.

If you include the space but nothing after it, Golly sees the name of the rule as ".rule" or "", and handles it perfectly fine, although I am unable to get to it from the Set Rule dialogue.

@TABLE
The documentation states that there must be an @TABLE or an @TREE section, or both. If we use an @TABLE section, then it must contain the three variables "n_states", "neighborhood", and "symmetries", and nothing else is required. If we simply want to make the smallest rule possible (which does nothing in this case), we could use the shortest values for each of these variables and leave the rule alone, which gives us 59 bytes:

Code: Select all

@RULE 
@TABLE
n_states:2
neighborhood:Moore
symmetries:none
Another Section for the Illusion of Structure
Maybe if I used an @TREE section I would've been able to create something smaller, but I have absolutely no understanding of them. And while it's kind of unrelated, trying to golf this down reminded me of this thing, which might be interesting to some of you.
succ

AforAmpere
Posts: 1334
Joined: July 1st, 2016, 3:58 pm

Re: Rule Golf

Post by AforAmpere » July 22nd, 2018, 11:14 am

Redstoneboi wrote:can we use different neighborhoods and instead count the score as the number of values written?
It would probably be better to keep it consistent with the neighborhoods. Luckily, that rule is doable in 3 transitions in Moore neighborhood as well:

Code: Select all

@RULE Example

@TABLE

n_states:2
neighborhood:Moore
symmetries:none

0,0,0,1,0,0,0,0,0,1
1,0,0,1,0,0,0,1,0,0
0,0,0,1,0,0,0,1,0,1
EDIT:
blah wrote:What about normal style code golf?
The problem with this is that is defeats the entire idea of variables counting as more than one transition. In actual golfing with your method, variables would be better to use, which is counter to what the purpose was, to find the rules with certain properties that have the least amount of transitions.
I manage the 5S project, which collects all known spaceship speeds in Isotropic Non-totalistic rules. I also wrote EPE, a tool for searching in the INT rulespace.

Things to work on:
- Find (7,1)c/8 and 9c/10 ships in non-B0 INT.
- EPE improvements.

User avatar
toroidalet
Posts: 1514
Joined: August 7th, 2016, 1:48 pm
Location: My computer
Contact:

Re: Rule Golf

Post by toroidalet » December 30th, 2019, 3:31 pm

(This isn't exactly related to the topic of this thread but I wasn't sure where else to put this)

How many table lines (counting variables) are needed for a Life ruletable?

Here's a 21-line table using rotate4reflect symmetry (I can provide details on how it works if needed):

Code: Select all

@RULE GolfLife
@TABLE
n_states:2
neighborhood:Moore
symmetries:rotate4reflect
var a={0,1}
var b=a
var c=a
var d=a
var e=a
var f=a
a,1,0,1,0,1,0,0,0,1
1,a,0,b,0,b,0,b,0,0
1,1,a,b,0,0,0,0,0,1
a,1,1,b,b,0,0,0,0,0
a,1,1,b,c,0,0,0,0,1
a,1,1,0,0,1,0,0,0,1
a,1,1,0,0,0,1,0,0,1
a,1,1,0,0,0,0,b,c,1
a,1,0,1,0,0,1,0,0,1
a,1,0,0,1,0,1,0,0,1
a,0,1,0,1,0,1,0,0,1
1,1,0,0,a,b,0,0,0,1
1,0,a,0,b,0,b,0,b,0
1,0,1,0,a,0,b,0,0,1
1,1,1,a,b,c,d,e,f,0
So this post won't be completely off-topic, here's a 9-transition table for an adjustable spaceship:

Code: Select all

@RULE GolfShip
@TABLE
n_states:3
neighborhood:Moore
symmetries:none
0,0,0,0,0,0,0,1,0,1
0,0,0,2,0,0,0,1,0,2
1,0,0,2,0,0,0,1,0,2
0,0,0,0,0,2,2,0,0,2
2,0,0,2,0,0,0,1,0,0
2,0,0,0,0,0,0,1,0,0
2,0,0,0,0,0,0,2,0,0
0,0,0,0,2,1,0,0,0,1
1,0,0,2,0,0,0,0,0,0
Any sufficiently advanced software is indistinguishable from malice.

Post Reply