A Life Worth Living

Discussion of challenges you have already solved
Chocoholic
Posts: 44
Joined: Mon Feb 16, 2009 4:11 pm
Location: UK

A Life Worth Living

Post by Chocoholic »

I'm curious how you solved this... Somehow I couldn't be bothered to find the period of all the oscillators and write down the formula. After all it was pretty easy, using Golly and a (slightly modified) goto.py script.
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

I used Golly too (after some hints in the Challenges forum)... but without any tweaks or scripts. It took ages to stop and forward to reach the right population. :lol:
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

:) and I used MCell
It was interesting!
User avatar
karma-fusebox
Posts: 23
Joined: Fri Mar 06, 2009 1:37 pm

Post by karma-fusebox »

the hlife-algorithm took about a second
User avatar
Hamstaro
Posts: 6
Joined: Fri Feb 06, 2009 3:34 pm

Golly is your friend

Post by Hamstaro »

10 000 000 000 cycles with hlife in golly - had the solution very quick - and u have also this nice gfx output 8)
xnop
Posts: 3
Joined: Fri Jun 12, 2009 4:00 pm

Post by xnop »

I found the period of the population vs generation (since the population grows linearly, the period could be found).

The period was 13398, and increment of the population per period was 716, though :?









but hlife did it in second
User avatar
sabretooth
Posts: 61
Joined: Sun Jul 12, 2009 3:13 pm

Post by sabretooth »

xnop wrote:I found the period of the population vs generation (since the population grows linearly, the period could be found).

The period was 13398, and increment of the population per period was 716, though :?
i also got the same values for the formula. I also worked out using an earlier test that if i started at gen 14158 I could write a program which would stop exactly on 10 bil. Which I did.
Nice and easy here:

Code: Select all

<?php
set_time_limit(0);
$start = 14158;  // this start value is chosen because the prog will land ecatle on 10bil with this.
$count = 1554;   // this is how many are alive at gen $start (courtesy of golly)

while($start < 10000000000)
{
$start += 13398;
$count += 716;
}
echo $start . " = " . $count;
?>
which neatly output for me 10000000000 = 534408918


Nice challenge, thanks.

sabre
nighthalk
Posts: 41
Joined: Fri Jul 31, 2009 8:22 pm

Post by nighthalk »

golly can do it in minutes if your careful with your faster/slower keys, ie you can set how fast it grows on hashlife mode. so just get it to 90ish bil, then 99, then 99.9 ect, when its like 9.9999E10 then just set generation to get the counter back down to a readable int. step the last dozenish on your own (undo only records when you hit pause).

and thank you for not being a count that is also expressed as an exponent or id have to save the result and hope i can count it from the file. hardest part was making sure every exact pixle matched the bmp map. i had "transcription" errors scaling it in paint
blablaSTX
Posts: 11
Joined: Mon Aug 17, 2009 8:12 pm
Contact:

Post by blablaSTX »

a png to rle converter helped - took only a few minutes to write...
Here's the code:

Code: Select all

_141_populationOfLifeGeneration_saveFile
    |img wI hI w h sample row col board margin|

    margin := 100.

    img := (PNGReader readStream:(HTTPInterface get:'http://www.hacker.org/challenge/img/life2.png') data readStream) image.
    wI := ((img width - 1) // 8).
    hI := ((img height - 1) // 8).

    w := margin + wI + margin.
    h := margin + hI + margin.

    board := Life_Board rows:h cols:w.
    row := col := 1.
    "/ take sample from the middle
    1 to:hI do:[:y |
        col := 1.
        1 to:wI do:[:x |
            sample := img colorAtX:((x-1)*8+1+4) y:((y-1)*8+1+4).
            (board at:row+margin) at:col+margin put:(sample = Color white ifTrue:[0] ifFalse:[1]).
            col := col + 1.
        ].
        row := row + 1.
    ].
    board saveInRLEFormatAs:'file.rle'
no hacker should have trouble reading smalltalk code...

The rest was easy, using golly.
User avatar
m!nus
Posts: 202
Joined: Sat Jul 28, 2007 6:49 pm
Location: Germany

Post by m!nus »

OT: wow. i never really looked at smalltalk, but after reading some wikipedia it seems quite smart to me. also very easy to learn
blablaSTX
Posts: 11
Joined: Mon Aug 17, 2009 8:12 pm
Contact:

Post by blablaSTX »

yes, smalltalk's syntax was made to read like english, with object, predicate, subject as in:
someObject doSomethingWith: argument.

Once you got used to its (non-C-like) syntax, it reads very easy.

((and it has all those fancy features like closures, reflection, meta-class protocols etc.
seems like a perfect hacker language to me.)
Gizmore
Posts: 4
Joined: Tue Jun 30, 2009 6:50 pm

Post by Gizmore »

Did it also with golly.

For the conversion i used JCS (own tool at wechall.net/tools/JCS) to suck the rgb values and put them into a same size bmp with a hex-editor.

The golly gui was insane fast within windows (using hyperspeed button).

But to solve it i needed to do bgolly -i 10000000 -m1000000000000 foo.rle (which took around 2 minutes)

Very nice challenge after all, was fun to mess with the problem :)
jonik555
Posts: 43
Joined: Mon Aug 31, 2009 6:18 pm
Location: Prague

Post by jonik555 »

I used Golly too. I have converted png to rle in PHP :D.
nice challenge. Very very nice pattern :D.
kalunos
Posts: 7
Joined: Sat Jun 18, 2011 7:22 pm
Location: germany

Post by kalunos »

i can tell u a little more about the result that i examined by hand (+golly):

there are 2 periodical activities in this world:

*154 .. the upper thing i called "glider machine"(A), the reflector (B), creating new gliders +(G1)/(G2)
*174 .. the moving "pathbuilder" (C), creating new pathmarks +(P1/2), killing gliders -(G1/2) ...

so i first had to calc 10 billion mod 154 and mod 174 to get the final cycle positions for both cycles.
write down the final state cell counts for all the base figures ...

then get the cycle counter for both (for the dynamic= created - swallowed gliders finally), sum together, finished.

final cells are:

+ 797 for the static content (A+B+C)
+ 14,927,601 moving gliders alive in the final state (by 5)
+ 114,942,529 path markers (by 4 cells each) on the way.

ok if i knew how to pimp golly to go to the final state that fast, i'd been done even faster :wink: ...

happy coding!
User avatar
fendi
Posts: 1
Joined: Mon May 17, 2010 11:37 am

Post by fendi »

Great pattern!!

:shock:
Post Reply