A Life Worth Living
-
- Posts: 44
- Joined: Mon Feb 16, 2009 4:11 pm
- Location: UK
A Life Worth Living
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.
- karma-fusebox
- Posts: 23
- Joined: Fri Mar 06, 2009 1:37 pm
Golly is your friend
10 000 000 000 cycles with hlife in golly - had the solution very quick - and u have also this nice gfx output
- sabretooth
- Posts: 61
- Joined: Sun Jul 12, 2009 3:13 pm
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.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
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;
?>
Nice challenge, thanks.
sabre
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
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
a png to rle converter helped - took only a few minutes to write...
Here's the code:
no hacker should have trouble reading smalltalk code...
The rest was easy, using golly.
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'
The rest was easy, using golly.
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.)
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.)
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
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
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 ...
happy coding!
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 ...
happy coding!