apgsearch - haul requests

For discussion of other cellular automata.
Post Reply
User avatar
Rhombic
Posts: 1056
Joined: June 1st, 2013, 5:41 pm

apgsearch - haul requests

Post by Rhombic » September 1st, 2016, 8:10 am

For those rules that deserve some more soup searches or just rules that you generally think could turn out to be interesting in Catagolue, you can post the rule and symmetry for people to (help in) search(ing) them.

My first suggestions:

b2-a3i4aijks2a3-i4/D4_x1 #because there are many potential oscillators, check for diagonal spaceships
b3s2-i34q/D4_x1 #same as above, and tlife has been extensively studied
b37s2-i34q/C1 #for general knowledge about relative abundance of patterns in tDryLife
SoL : FreeElectronics : DeadlyEnemies : 6a-ite : Rule X3VI
what is “sesame oil”?

muzik
Posts: 3510
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: apgsearch - haul requests

Post by muzik » September 1st, 2016, 8:14 am

I would be doing tdry right now, but as stated many times before my computer is not connected to the Internet and probably won't be for a good while
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

User avatar
_zM
Posts: 172
Joined: June 26th, 2016, 3:07 pm

Re: apgsearch - haul requests

Post by _zM » September 1st, 2016, 9:10 am

B2c3-i/S1c23 has a lot of still lifes and oscillators and, despite being close to Life in terms of transitions, has way different behavior.
Creator of multiple rules that may or may not be what you'd expect

muzik
Posts: 3510
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: apgsearch - haul requests

Post by muzik » September 1st, 2016, 12:45 pm

B35678/S is an extremely easy and fast rule to apgsearch, even on the Python version. On my apgmera, individual hauls of 100,000,000 soups can rack up just about a million objects each.

We could all spam search this to check for three things:

1. Aside from xp2 and xp4, are there any other periods of naturally occuring phoenixes?

2. Can phoenixes of odd periods exist?

3. Can we crash Catagolue with it?
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

User avatar
_zM
Posts: 172
Joined: June 26th, 2016, 3:07 pm

Re: apgsearch - haul requests

Post by _zM » September 1st, 2016, 12:55 pm

muzik wrote:B35678/S is an extremely easy and fast rule to apgsearch, even on the Python version. On my apgmera, individual hauls of 100,000,000 soups can rack up just about a million objects each.

We could all spam search this to check for three things:

1. Aside from xp2 and xp4, are there any other periods of naturally occuring phoenixes?

2. Can phoenixes of odd periods exist?

3. Can we crash Catagolue with it?
I'm coming!
Creator of multiple rules that may or may not be what you'd expect

muzik
Posts: 3510
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: apgsearch - haul requests

Post by muzik » September 1st, 2016, 1:00 pm

Hahah, 2^22 is way too small. Try something like 2^27.

Unless 4194304 is your limit for some reason.



EDIT: just calculated, there's about 1 item per 128 soups (extremely rounded).
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

User avatar
_zM
Posts: 172
Joined: June 26th, 2016, 3:07 pm

Re: apgsearch - haul requests

Post by _zM » September 1st, 2016, 1:10 pm

Ok then. 134217728 sups per upload here I come.
(The reason why I upload so small soups is because then I can stop the search after a haul gets uploaded more frequently.)
Creator of multiple rules that may or may not be what you'd expect

Rich Holmes
Posts: 55
Joined: October 31st, 2015, 1:13 am

Re: apgsearch - haul requests

Post by Rich Holmes » September 1st, 2016, 2:01 pm

Can anyone point me to a fairly detailed recipe for how to do non totalistic rules with apgmera? Edit: Never mind, got an answer elsewhere: Apparently can't be done yet.
Last edited by Rich Holmes on September 1st, 2016, 7:00 pm, edited 1 time in total.

muzik
Posts: 3510
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: apgsearch - haul requests

Post by muzik » September 1st, 2016, 2:10 pm

Rich Holmes wrote:Can anyone point me to a fairly detailed recipe for how to do non totalistic rules with apgmera?
Have you seen non-totalistic hauls submitted from apgmera?

Might be something linked to Golly 2.8
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

User avatar
A for awesome
Posts: 1903
Joined: September 13th, 2014, 5:36 pm
Location: 0x-1
Contact:

Re: apgsearch - haul requests

Post by A for awesome » September 1st, 2016, 5:24 pm

I would like to see people searching b3s2-i34q/C1 as well, if that's possible. I used to devote a lot of my CPU time to that until the fan broke on my old computer (probably because of either that or Khan Academy's horribly inefficient JS interpreter).
x₁=ηx
V ⃰_η=c²√(Λη)
K=(Λu²)/2
Pₐ=1−1/(∫^∞_t₀(p(t)ˡ⁽ᵗ⁾)dt)

$$x_1=\eta x$$
$$V^*_\eta=c^2\sqrt{\Lambda\eta}$$
$$K=\frac{\Lambda u^2}2$$
$$P_a=1-\frac1{\int^\infty_{t_0}p(t)^{l(t)}dt}$$

http://conwaylife.com/wiki/A_for_all

Aidan F. Pierce

User avatar
BlinkerSpawn
Posts: 1907
Joined: November 8th, 2014, 8:48 pm
Location: Getting a snacker from R-Bee's

Re: apgsearch - haul requests

Post by BlinkerSpawn » September 1st, 2016, 7:27 pm

A for awesome wrote:I would like to see people searching b3s2-i34q/C1 as well, if that's possible. I used to devote a lot of my CPU time to that until the fan broke on my old computer (probably because of either that or Khan Academy's horribly inefficient JS interpreter).
I would also like somebody to attempt this, if only so that I can get back into tlife synthesis-building.
LifeWiki: Like Wikipedia but with more spaceships. [citation needed]

Image

User avatar
Rhombic
Posts: 1056
Joined: June 1st, 2013, 5:41 pm

Re: apgsearch - haul requests

Post by Rhombic » September 14th, 2016, 4:54 pm

B2n37e/S2-i34q is extremely slow to apgsearch... however, it probably exhibits sufficiently interesting complex behaviour. Among other things, the speed bump in tDryLife with a T eating a beehive becomes spaceship (xq23).
SoL : FreeElectronics : DeadlyEnemies : 6a-ite : Rule X3VI
what is “sesame oil”?

muzik
Posts: 3510
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: apgsearch - haul requests

Post by muzik » November 20th, 2016, 3:02 pm

b3-cekys23-cik/D2_+2

This rule supports copperheads and I want to see if I can find one occurring naturally. Anyone else want to sacrifice some computer power?
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

David
Posts: 212
Joined: November 3rd, 2009, 2:47 am
Location: Daejeon, South Korea

Re: apgsearch - haul requests

Post by David » November 21st, 2016, 1:14 am

The closest non-totalistic rules from B3/S23, e.g. B3/S234c, B3/S234e, B34c/S23, B34e/S23.
Let's see how they are different from B3/S23.
Call me "Dannyu NDos" in Forum. Call me "Park Shinhwan"(박신환) in Wiki.

muzik
Posts: 3510
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: apgsearch - haul requests

Post by muzik » November 21st, 2016, 4:23 pm

Gonna try to get b3s12 back to the third place again. Anyone with me? Or will that just get me more opponents?
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

User avatar
drc
Posts: 1664
Joined: December 3rd, 2015, 4:11 pm
Location: creating useless things in OCA

Re: apgsearch - haul requests

Post by drc » November 21st, 2016, 7:17 pm

muzik wrote:Gonna try to get b3s12 back to the third place again. Anyone with me? Or will that just get me more opponents?
Challenge. Accepted.
*rapidly searches B3567/S13 because why not*
This post was brought to you by the letter D, for dishes that Andrew J. Wade won't do. (Also Daniel, which happens to be me.)
Current rule interest: B2ce3-ir4a5y/S2-c3-y

shouldsee
Posts: 406
Joined: April 8th, 2016, 8:29 am

Re: apgsearch - haul requests

Post by shouldsee » February 17th, 2017, 7:28 pm

I've recently formed a set of apgsearchable rules. (G means spontaneous glider emergence, Gs means multiple gliders, E means )
notations:

G:natural glider emergence from random soup, Gs for multiple gliders
E: explosive, not searchable
L: close to B3S23
F: fast stabilised

They are originally recorded in TCA_id*, I have added B/S notation for readability.

A concise list (doubly fixed):

Code: Select all

B_S_alias	comments      TCAid	
b38s24578	G	223496
b368s24578	G	223560
b3468s0124678	GF	241496
b38s12568	G	183560
b3678s13567	Gepp	120264
b3578s126	*G	36264
b368s024578	GSl	224072
b3678s23	*LE	6600
b358s3478	*Gs	209192
b368s2457	*Gs	92488
b367s03468	GF	176840
The actual list(updated):

Code: Select all

B_S_alias	comments      TCAid	
b356s0457		90728
b34s156		50200
b378s02458		158600
b3567s034		13032
b3478s0278		199576
b38s0245		27400
b3468s168		165208
b3678s05678	?	246728
b367s13568	*	185544
b378s125		19848
b38s2378	L	203016
b356s24		10344
b38s125	*	19720
b35678s0147		75752
b358s0145		26408
b348s0178	*	198424
b35s0347		78376
b358s0347		78632
b36s01368		169544
b38s1256	H	52488
b37s0135	*	22152
b38s02456	*?	60168
b3578s128		134568
b38s24578	G	223496
b345678s013678		235512
b38s0137		71432
b378s245		27016
b367s2458		157896
b3478s267		100760
b357s14578		222376
b3478s1567		116120
b3578s024		11176
b368s24578	G	223560
b346s278		198744
b347s0378	*	201368
b367s03467		111304
b348s26		35096
b3678s2378	LE	203208
b358s024		11048
b3567s128	F	134376
b3s1356		54280
b346s038		135768
b3468s0124678	GF	241496
b38s12568	G	183560
b3578s136	F	38312
b3568s1467	F	107880
b34678s28	F	133592
b368s238	LV	137544
b347s017	F	67224
b367s2457		92360
b3678s13567	Gepp	120264
b356s0348		143976
b358s02478		207656
b378s1258		150920
b3578s126	*G	36264
b3468s02		2904
b35s1358	Sl	152616
b3678s0134678		243656
b35s01458	M	157224
b357s02567		117416
b3467s02		2776
b368s024578	GSl	224072
b3568s23	LE	6504
b36s238	LV	137288
b356s1278		199784
b367s23	LE	6344
b3467s028	F	133848
b367s01367		104136
b3678s23	*LE	6600
b358s3478	*Gs	209192
b3478s268		166296
b3678s3467	Sched	111048
b347s36		37016
b3458s2	F	2360
b346s03		4696
b368s2457	*Gs	92488
b367s03468	GF	176840
b346s378		200792
b3567s248		141544
b378s024578		224136
b3567s02578	F	215784
b347s367	F	102552
b345s18		132152
b36s13567	*	119880
b347s0278	F	199320

*:TCA_id is a decimal number specifying the rule.
For example:
B3/S23 =
reverse((000100000001100000)b)=
(000001100000001000)b=
(6152)d
Last edited by shouldsee on February 19th, 2017, 10:12 am, edited 2 times in total.

User avatar
Apple Bottom
Posts: 1027
Joined: July 27th, 2015, 2:06 pm
Contact:

Re: apgsearch - haul requests

Post by Apple Bottom » February 18th, 2017, 7:57 am

shouldsee wrote:A concise list:

Code: Select all

TCAid	B_S_alias	comments
245156	b37s1346	G
[...]
242001	b367s02456	Gepp
[...]
1100	b357s236	Gs
243109	b367s1346	Gs
These are explosive as well, though?
If you speak, your speech must be better than your silence would have been. — Arabian proverb

Catagolue: Apple Bottom • Life Wiki: Apple Bottom • Twitter: @_AppleBottom_

Proud member of the Pattern Raiders!

shouldsee
Posts: 406
Joined: April 8th, 2016, 8:29 am

Re: apgsearch - haul requests

Post by shouldsee » February 18th, 2017, 9:51 am

Apple Bottom wrote:
shouldsee wrote:A concise list:

These are explosive as well, though?
Yeah sorry some labels are incorrect. Thank for spotting. Should be fixed now.

EDIT: Actually, it appear as a result of faulty translation from TCAid to BS notation.(Actaully this translation is fine, the problem is when I tried to invert rules into B3....) Their TCAid appear non-explosive when I emulated them with my custom script.
The script is attached.

Code: Select all

## This script emulate a BS rule by its decimal TCA id
## Written by Feng (shouldsee.gem@gmail.com) Feb 2017.
import golly
rnum=golly.getstring('TCA number','6152');




r=bin(int(rnum));
r=r[:1:-1];
r+='0'*(18-len(r));

rule=[i for x,i in zip(r,range(len(r))) if x=='1'];

alias='b';

ps=1;
for a in rule:
	if a>8 and ps:
		alias+='s';
		ps=0;
	alias+=str((a)%9)
if ps==1:
	alias+='s';


golly.setalgo("QuickLife")
# golly.note(alias)
golly.setrule(alias);
golly.setclipstr('\n'+rnum);
Last edited by shouldsee on February 19th, 2017, 10:13 am, edited 1 time in total.

User avatar
Apple Bottom
Posts: 1027
Joined: July 27th, 2015, 2:06 pm
Contact:

Re: apgsearch - haul requests

Post by Apple Bottom » February 19th, 2017, 7:53 am

shouldsee wrote:EDIT: Actually, it appear as a result of faulty translation from TCAid to BS notation.
Yeah, something's wrong there. I checked your "actual list" from above, using this description of how TCA_ids are derived:
shouldsee wrote: *:TCA_id is a decimal number specifying the rule.
For example:
B3/S23 =
reverse((000100000001100000)b)=
(000001100000001000)b=
(6152)d
(Incidentally, this is the same scheme I've also been using in my own files to number rules. Given how obvious, straightforward and (largely) unambiguous it is, I documented it on on the wiki as well.)

Anyhow -- about half of the rules in your list don't check out:

Code: Select all

$ cat shouldsee_list.txt |perl verify_shouldsee_list.pl
b356s0457      239333
        Decoded TCA_id: b02567s014678
b34s156      237427
        Decoded TCA_id: b014568s0123678
b3567s034      238287
        Decoded TCA_id: b012367s04678
b3468s168      234874
        Decoded TCA_id: b134568s13678
b3678s05678   ?   241904
        Decoded TCA_id: b4567s34678
b367s13568   *   242514
        Decoded TCA_id: b1468s034678
b378s125      244023
        Decoded TCA_id: b012458s234678
b38s2378   L   245148
        Decoded TCA_id: b23478s1234678
b38s125   *   245047
        Decoded TCA_id: b012458s1234678
b35678s0147      237677
        Decoded TCA_id: b02356s4678
b348s0178   *   236668
        Decoded TCA_id: b23456s123678
b35s0347      241357
        Decoded TCA_id: b02367s0124678
b36s01368      243290
        Decoded TCA_id: b1346s0134678
b38s1256   H   245043
        Decoded TCA_id: b01458s1234678
b38s24578   G   245156
        Decoded TCA_id: b2578s1234678
b38s0137      244829
        Decoded TCA_id: b02346s1234678
b3478s267      235961
        Decoded TCA_id: b034578s23678
b3578s024      239791
        Decoded TCA_id: b012357s24678
b346s278      235452
        Decoded TCA_id: b234578s013678
b367s03467      242377
        Decoded TCA_id: b0367s034678
b348s26      236987
        Decoded TCA_id: b0134578s123678
b367s2457      242597
        Decoded TCA_id: b02578s034678
b3678s13567   Gepp   242001
        Decoded TCA_id: b0468s34678
b358s02478      240812
        Decoded TCA_id: b2357s124678
b378s1258      244022
        Decoded TCA_id: b12458s234678
b3578s126   *G   239931
        Decoded TCA_id: b013458s24678
b35s1358   Sl   241494
        Decoded TCA_id: b12468s0124678
b357s02567      240305
        Decoded TCA_id: b0457s024678
b3568s23   LE   239007
        Decoded TCA_id: b0123478s14678
b356s1278      239420
        Decoded TCA_id: b23458s014678
b3467s028   F   234174
        Decoded TCA_id: b123457s03678
b358s3478   *Gs   241100
        Decoded TCA_id: b23678s124678
b3478s268      235962
        Decoded TCA_id: b134578s23678
b3678s3467   Sched   242121
        Decoded TCA_id: b03678s34678
b347s36      236507
        Decoded TCA_id: b0134678s023678
b346s03      235231
        Decoded TCA_id: b0123467s013678
b368s2457   *Gs   243109
        Decoded TCA_id: b02578s134678
b346s378      235484
        Decoded TCA_id: b234678s013678
b3567s248      238510
        Decoded TCA_id: b123578s04678
b3567s02578   F   238260
        Decoded TCA_id: b2457s04678
b347s367   F   236505
        Decoded TCA_id: b034678s023678
b345s18      233342
        Decoded TCA_id: b1234568s012678
b36s13567   *   243537
        Decoded TCA_id: b0468s0134678
b347s0278   F   236220
        Decoded TCA_id: b23457s023678
Total lines: 85, failed matches: 44
$ 
This is the script used:

Code: Select all

#!/usr/bin/perl

# usage: e.g.
# $ echo 6152 | perl rulestring2number.pl
# $ cat rulenumbers.txt | perl rulestring2number.pl

use Modern::Perl '2014';

# throw away first line
<>;

my $total_lines = 0;
my $failed_matches = 0;

while(<>) {
    $total_lines++;

    chomp;

    my ($ss_rule, $ss_comment, $ss_number) = split "   ";

    my %Bs;
    my %Ss;

    foreach my $B (0 .. 8) {
        $Bs{$B}++ if($ss_number & (2 ** $B));
    }

    foreach my $S (0 .. 8) {
        $Ss{$S}++ if($ss_number & (2 ** ($S + 9)));
    }

    my $rulestring = "b" . (join "", sort keys %Bs) . "s" . (join "", sort keys %Ss);

    if($rulestring ne $ss_rule) {
        say;
        say "\tDecoded TCA_id: $rulestring";

        $failed_matches++;
    }
}

say "Total lines: $total_lines, failed matches: $failed_matches";
If you speak, your speech must be better than your silence would have been. — Arabian proverb

Catagolue: Apple Bottom • Life Wiki: Apple Bottom • Twitter: @_AppleBottom_

Proud member of the Pattern Raiders!

shouldsee
Posts: 406
Joined: April 8th, 2016, 8:29 am

Re: apgsearch - haul requests

Post by shouldsee » February 19th, 2017, 8:38 am

Apple Bottom wrote:
[...]

Anyhow -- about half of the rules in your list don't check out:
Sorry I should make it clear that I inverted some of rule to b3 scheme but left TCA_id unchanged.

b356s0457 239333
Decoded TCA_id: b02567s014678

Observe that B02567/S014678 is the on/off symmetric rule of B356/S0457.
I will change the corresponding TCA_id shortly.
Last edited by shouldsee on February 19th, 2017, 10:14 am, edited 2 times in total.

User avatar
Apple Bottom
Posts: 1027
Joined: July 27th, 2015, 2:06 pm
Contact:

Re: apgsearch - haul requests

Post by Apple Bottom » February 19th, 2017, 8:45 am

shouldsee wrote:Sorry I should make it clear that I inverted some of rule to b3 scheme but left TCA_id unchanged.

b356s0457 239333
Decoded TCA_id: b02567s014678

Observe that B02567/S014678 is the on/off symmetric rule of B356/S0457.
I will change the corresponding TCA_id shortly.
Gotcha! Accounting for black/white reversals everything checks out.
If you speak, your speech must be better than your silence would have been. — Arabian proverb

Catagolue: Apple Bottom • Life Wiki: Apple Bottom • Twitter: @_AppleBottom_

Proud member of the Pattern Raiders!

shouldsee
Posts: 406
Joined: April 8th, 2016, 8:29 am

Re: apgsearch - haul requests

Post by shouldsee » February 19th, 2017, 3:53 pm

Apple Bottom wrote: (Incidentally, this is the same scheme I've also been using in my own files to number rules. Given how obvious, straightforward and (largely) unambiguous it is, I documented it on on the wiki as well.)
Speaking of that, do you know of a decimal notation of non-totalistic rules? I find it hard to script with non-tot rules.

User avatar
Apple Bottom
Posts: 1027
Joined: July 27th, 2015, 2:06 pm
Contact:

Re: apgsearch - haul requests

Post by Apple Bottom » February 19th, 2017, 4:42 pm

shouldsee wrote:Speaking of that, do you know of a decimal notation of non-totalistic rules? I find it hard to script with non-tot rules.
There's none that I'm aware of, save for a scheme I came up with myself about a year ago. It works as follows:

For a given non-totalistic rule...
  1. Determine the rule integer as usual, ignoring non-totalistic subconditions.
  2. For each B or S condition present in the rule, convert its subconditions to a bitstring, with 0 indicating the configuration is included in the rule and 1 indicating it's excluded (in particular, note that a "full" condition will result in an all-0 bitstring). Configurations are considered in the following order: cekainyqjrtwz (the same given by Alan Hensel).
  3. Concatenate all those bitstrings.
  4. Convert the result to octal (padding the bitstring with zeros at the right if its length is not a multiple of three).
  5. Remove trailing zeros from the octal string.
  6. Replace any occurence of 000 with a 9, and any occurence of 00 with an 8.
  7. Interpret the result as a decimal suffix and attach it to the totalistic rule number determined in step 1.
An example is certainly in order. Take the rule B2ce3ai/S23.
  1. Ignore subconditions and determine rule integer:
    B23/S23
    6156
  2. Bit strings for the subconditions:
    B2 = 001111
    B3: 1110011111
    S2: 000000
    S3: 0000000000
  3. Concatenate and pad with zeroes:
    001 111 111 001 111 100 000 000 000 000 00(0)
  4. convert to octal:
    17717400000
  5. remove trailing zeros:
    177174
  6. replace 000 and 00 (there aren't any in this example):
    177174
  7. append to rule integer:
    6156.177174
So the rational number corresponding to B2ce3ai/S23 is 6156.177174. There's two nice things about this scheme (which, modest person that I am[1], I've come to refer to as "Apple Bottom numbers"):
  • For totalistic rules, the suffix works out to 0, so the rational number assigned this way is actually the same as the rule integer.
  • Looking at the integer part of the resulting rational number, you'll immediately get an idea what this rule is a variant of.
Regarding the second bullet point, consider, for instance:

Code: Select all

B37/S23 (#6280)
B37c/S23 (#6280.91) {OT}
B37e/S23 (#6280.92) {OT}
There's downsides to this scheme as well. The resulting numbers can become quite large, and may contain long runs of 9's. Also, encoding/decoding is a bit more complex than in the totalistic/integer case.

Here's a script of mine that can be used to convert a list of rules (in B.../S... format) to their Apple Bottom numbers (wow, I can't even type that without grinning):

Code: Select all

#!/usr/bin/perl

use Modern::Perl '2014';

our $neighborhoods = {
    '0' => '',
    '1' => 'ce',
    '2' => 'cekain',
    '3' => 'cekainyqjr',
    '4' => 'cekainyqjrtwz',
    '5' => 'cekainyqjr',
    '6' => 'cekain',
    '7' => 'ce',
    '8' => ''
};

# convert a binary string to octal. Note that e.g. sprintf won't work
# because we need to preserve leading zeros.  Still fairly sure there's got
# to be a better way of doing this.
sub bin2oct {
    my ($binary_string) = @_;
    my $octal_string = "";

    # pad with zeros to a length that's a multiple of 3. Is there a less
    # convoluted way of doing this?
    $binary_string .= "0" x ((3 - (length($binary_string) % 3)) % 3);

    # process in chunks of three characters.
    while($binary_string =~ m/(...)/g) {
        $octal_string .= oct("0b" . $1);
    }

    return $octal_string;
}

sub configs2suffix {
    my ($digit, $configs) = @_;

    my $negated = 0;
    my $suffix  = "";

    # any configs given?
    if($configs ne "") {

        # negated?
        if($configs =~ m/^-/) {
            $configs = substr $configs, 1;
            $negated = 1;
        }

        # create a hash containing configs seen
        my %configs = map { $_ => 1 } split //, $configs;

        # iterate through all possible configs and see if they're set.
        foreach my $type (split //, $neighborhoods->{$digit}) {

            # we append a 0 for configs specified, and a 1 for configs not
            # specified.  This is consistent with using all zeros if no
            # configs are explicitely specified, in which case all are
            # assumed to be set.
            unless($negated) {
                $suffix .= ($configs{$type} ? "0" : "1");
            } else {
                $suffix .= ($configs{$type} ? "1" : "0");
            }
        }


    } else {

        # no configs given, so we default to all zeros.
        $suffix = "0" x length($neighborhoods->{$digit});
    }

    return $suffix;
}

while(<>) {
    chomp;

    my $number = 0;
    my $suffix = "";

    my ($Bs, $Ss) = split /\//, $_;

    # remove B... and S...
    $Bs =~ s/^[Bb]//;
    $Ss =~ s/^[Ss]//;

    # split on positive-lookahead
    my @B = split /(?=\d)/, $Bs;
    my @S = split /(?=\d)/, $Ss;

    # figure out each B condition...
    foreach my $B (@B) {
        my $digit   = substr $B, 0, 1;
        my $configs = substr $B, 1;

        $number += 2 ** $digit;
        $suffix .= configs2suffix($digit, $configs);
    }

    # ...and each S condition
    foreach my $S (@S) {
        my $digit   = substr $S, 0, 1;
        my $configs = substr $S, 1;

        $number += 2 ** ($digit + 9);
        $suffix .= configs2suffix($digit, $configs);
    }

    $suffix = bin2oct($suffix);

    # trim trailing zeros.
    $suffix =~ s/0+$//;

    # replace 000 with 9, and 00 with 8.
    $suffix =~ s/000/9/g;
    $suffix =~ s/00/8/g;

    # if the suffix is all zeros, it's a totalistic rule.
    if($suffix ne "" and $suffix != 0) {
        say "$_ (#$number.$suffix) {OT}";
    } else {
        say "$_ (#$number)";
    }
}
1. Modesty is my only vice. If I weren't so modest, I'd be perfect. -- John Horton Conway (quoted in "Genius at Play").
Last edited by Apple Bottom on February 19th, 2017, 7:02 pm, edited 1 time in total.
If you speak, your speech must be better than your silence would have been. — Arabian proverb

Catagolue: Apple Bottom • Life Wiki: Apple Bottom • Twitter: @_AppleBottom_

Proud member of the Pattern Raiders!

shouldsee
Posts: 406
Joined: April 8th, 2016, 8:29 am

Re: apgsearch - haul requests

Post by shouldsee » February 19th, 2017, 5:17 pm

Apple Bottom wrote:
shouldsee wrote:Speaking of that, do you know of a decimal notation of non-totalistic rules? I find it hard to script with non-tot rules.
There's none that I'm aware of, save for a scheme I came up with myself about a year ago. It works as follows:

For a given non-totalistic rule...
Thank you for this informative scheme and I think you deserve its name (lol).

The only unnatural part to me is the padding.

The problem as I view it is that different B/S principal number have a different number of sub-neighborhoods, asking each neighborhood to be expanded differently. It would also be great if the scheme allow a easy transfer towards non-istropic non-totalistic rules (aka the most general form of 2d Moore rules, which would obviously be sufficiently described with a 2^9=512 bit string ).

Post Reply