Add 2019/dogon/try.sh, update bugs.md, README.md

Updated Makefile so one can easily change the 'Z' macro by doing:

    make clobber MEMORY=... all

This is not usually useful but there are occasions where it is. As the
README.md points out this value must be a power of two!

The try.sh script runs the program on a number of the mc files, first
showing the input keys as a reminder (it also reminds one to keep in
mind the focus of windows).

The bugs.md is updated to note that it uses gets(3).

Format/typo check README.md file.

I changed the number of years ago that microorganisms appeared on Earth
as the number was off: there are those wondrous hydrothermal vents that
spewed mineral rich waters. Fun fact on the history of the Earth: did
you know that as of 2013 the number of years since the dinosaurs were
wiped out is not 65m years but actually 66m? That means that if you were
born before 2013 and you didn't die right before the revision that
you're in a rare group of people who have had a major historical update
as far as the dinosaurs go. But don't let it get to your head too much!
It also means you're ancient, possibly even a dinosaur, and you're
headed their way. :-) That's the price we must pay for being in that
group.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-16 09:33:17 -08:00
1 parent 5906389fa8
commit 01dd7bdee7
7 files changed
+187 -94

No files matched your search

+76 -54
View File
@@ -5,6 +5,17 @@ make
```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: uses gets() - change to fgets() if possible
```
For more detailed information see [2019 dogon in bugs.md](/bugs.md#2019-dogon).
## To use:
```sh
@@ -15,24 +26,19 @@ make
### Try:
```sh
./prog < glider.mc
./prog < infinite_5x5.mc
./prog < mosquito5.mc
# Press the minus key a few times until you see white specks,
# then press space, and the ] key a few times.
./prog < message.mc
./try.sh
```
Make sure that you keep focus of windows in mind when going back and forth to
the program and the script.
## Judges' remarks:
[1991/davidguy](http://ioccc.org/years.html#1991_davidguy),
[2011/blakely](http://ioccc.org/years.html#2011_blakely), ...
...This entry likely concludes the IOCCC category "Cellular automata simulators",
...This entry likely concludes the IOCCC category "Cellular automata simulators";
it would be very hard to beat it on its field.
FYI: The `.mc` extension stands for `Golly macrocell` format.
@@ -43,49 +49,58 @@ We truly have not much more to add, except two things:
you are much more likely to see a blank board rather than the loaded configuration,
and to see it, you may need to zoom out a few times.
* if you're using a virtual machine with less than 4 Gb of available
* If you're using a virtual machine with less than 4 Gb of available
model RAM, you'd want to reduce the value of the Z define in the Makefile
to 0x10000000, otherwise the entry will promptly crash.
to `0x10000000`, otherwise the entry will promptly crash. To do this you can do:
make clobber MEMORY=0x10000000 all
Notice that that value must be a power of two!
In the interest of saving lives, this entry was not fuzzed.
## Author's remarks:
### What is it?
Just run with no arguments on an X11-compatible system using one of the supplied
input `.mc` files as standard input. Press '-' several time to zoom out if
necessary, then press space. For acceleration press ']' several times. That's
input `.mc` files as standard input. Press `-` several time to zoom out if
necessary, then press space. For acceleration press `]` several times. That's
rather quick don't you think?
### Historical Timeline.
* 3.5 Billion years ago: Microorganism life appears on earth.
### Historical Timeline
* Circa 3.77 - 4.28 Billion years ago: Microorganisms appear on Earth.
* 3000 BC: Ankh symbol is used in Egyptian hieroglyph to represent life.
* 1940s: John Von Neumann and Stanislav Ulam are interested in artificial life
eventually kick starting research on Cellular Automata.
* 1970: J.H. Conway's research discovers a rather minimal set of rules that
seems quite interesting. Conway's game of life gets published in Martin
Gardner's Scientific American column.
* 1970's: According to Knuth, a significant portion of computer time in the
seems quite interesting. [Conway's Game of
Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) gets published in
[Martin Gardner's Scientific American
column](https://web.stanford.edu/class/sts145/Library/life.pdf).
* 1970s: According to Knuth, a significant portion of computer time in the
world is spent simulating GOL, mostly without the awareness of the people
footing the bill.
* 1984: Bill Gosper invents the
[Hashlife](https://en.wikipedia.org/wiki/Hashlife) algorithm. His
implementation runs on Symbolics Lisp Machines. Unrelated to that, but in a
cosmic coincidence the first IOCCC is run!
cosmic coincidence the [first IOCCC](/years.html#1984) is run!
* December 2000: Tom Rokicki has a breakthrough implementing
[Hashlife](https://en.wikipedia.org/wiki/Hashlife) in C, efficient, stable and
production ready for modern machines.
* 2006: First version of Golly by Andrew Trevorrow and Tomas Rokicki. Brings
the delights of [hashlife](https://en.wikipedia.org/wiki/Hashlife) to the masses.
\
Which brings us to the present moment in time.
### Full documentation and keys UI.
Yes, this program is Conway's Game of Life graphic simulator implementing Bill
### Full documentation and keys UI
Yes, this program is a Conway's Game of Life graphic simulator implementing Bill
Gosper's hashlife algorithm. The entry's UI is rather terse and somewhat
obfuscated, as it should be. Also, when you, accidentally or not, press any of
the keys not specified below, some stuff will happen or not, there is no
@@ -108,20 +123,21 @@ the header comment of each.
* `]`: Increase speed (time step) by a factor of 2.
* `[`: Decrease speed (time step) by a factor of 2.
Notice that when going backward in time we ignore current time step setting and
just jump by the amount that was specified before. However going forward is
Notice that when going backward in time we ignore the current time step setting
and just jump by the amount that was specified before. However going forward is
always using the current time step.
There is a minimal text printout by the program, so you can know what Generation
your are in (G:), Internal memory allocated till now (M:), and then which Level
is the current macrocell (L) and which zoom Scale you are watching (S).
your are in (`G:`), Internal memory allocated till now (`M:`), and then which Level
is the current macrocell (`L`) and which zoom Scale you are watching (`S`).
### Portability issues.
### Portability issues
This entry is quite portable hopefully on most modern platforms. It assumes X
Window support of course. More than 2GBytes memory is recommended. Configuration
Window support of course. More than 2GB of memory is recommended. Configuration
through [Makefile](Makefile) is provided for the display windows size and for
the memory usage. The Makefile provided configuration (Z=0x20000000) will need a
the memory usage. The Makefile provided configuration (`Z=0x20000000`) will need a
system with 4GB DRAM to run nicely. There are several other salient assumptions
though:
@@ -131,10 +147,11 @@ pointers which are 64 bits these days, in order to save space. On machines with
* The entry assumes the X11 displays default visual has 24 bit depth (RGB).
* The entry assumes little endianness (in only one place though! If you have
PowerPC you can try and find that place to make it work), but more than this it
assumes unaligned loads of 64 bits longs are supported, i.e. it assumes that a
long can be loaded from any address that could hold an int otherwise. On non
assumes unaligned loads of 64 bits `long`s are supported, i.e. it assumes that a
`long` can be loaded from any address that could hold an `int` otherwise. On non
antiquated X86 you'll be fine.
* The entry heavily relies on bit complement arithmetic (you don't say!).
* The entry heavily relies on bitwise arithmetic (you don't say!).
### Limitations:
@@ -150,29 +167,30 @@ that is not too much. It does not do any garbage collection, so sooner or later
memory will run out, resulting, surprise, surprise, in a core dump. On the plus
side, this enables the nice time reversal feature... Anyway the amount of memory
used can be controlled by the Makefile `-DZ=...` argument. With the default `Z`,
the program will support in total about 240 million 64bit longs for the internal
the program will support in total about 240 million 64bit `long`s for the internal
memory, which should be sufficient for about 100 million nodes+leafs, as each
node is 3 longs and each leaf is 2.
node is 3 `long`s and each leaf is 2.
*Important:* Makefile Z define must be a power of two!
*Important:* Makefile `Z` define must be a power of two!
Zooming out past about S58 scale will enter a buggy twilight zone as only long
integers are used in the drawing code. Reverting to doubles could have remedied
Zooming out past about S58 scale will enter a buggy twilight zone as only `long`
integers are used in the drawing code. Reverting to `double`s could have remedied
that, but then I'd need to use a lot of `ldexp()`s which would take the program
over the size limit. Also the program will crash once the universe goes past
level 64, though this is simply fixed by modifying a single constant in the
program, can you find it ? Anyway 2^58 squared is quite a big enough universe
program, can you find it ? Anyway `2^58` squared is quite a big enough universe
for such a tiny program to simulate, no ?
In case cell memory did not run out, or your pattern did not grow too big, and
you have had patience enough and did not increase speed too much, you can run
out of the history buffer after 33333 steps.
out of the history buffer after `33333` steps.
If all of the above did not happen and result in the expected core dump, you
will encounter the final limitation, which is the absence of an escape key. Just
close the window or use ^C to exit ....
close the window or use `^C`/intr to exit ....
### Warnings.
### Warnings
Oh don't get me started on the torrent of litanies gcc emits when used with
`-Wall`! Does it think I have not memorized by heart C's precious operator
@@ -181,30 +199,33 @@ extra parentheses that would take the program over the limit ? And what if I do
not use a variable here or there, do I have to pay extra tax for every orphaned
variable?
There is the reasonable warning about some longs printed as ints but its OK too,
There is the reasonable warning about some `long`s printed as `int`s but its OK too,
trust me.
Then there's the warning about 'gets' being unsafe, which is indeed the only one
Then there's the warning about `gets(3)` being unsafe, which is indeed the only one
that appears by default in some versions of gcc linker. Yes Virginia, I know it
is unsafe, and I would not recommend anyone using this entry as part of a web
daemon, or a spaceship, no, seriously don' do that.
### Obfuscations.
### Obfuscations:
Well almost none of the obfuscations are done on purpose, but mostly out of
necessity, so all identifiers possible to be one character, are, and they are
mercilessly reused. In the main there's even a nice little identifier first used
as a global and then reused (shadowed) in the *same* scope, and this did not
produce even a little squeak of a warning from the compiler! Macro compression is
rather sparingly used, however magic numbers abound everywhere, and bit twiddling
is magical too. Do you know for example why we have unsigned F=-1 ? (No warning
there of course :) Hint: Later in the program you have F/=17. Did that make any
sense? Further hint: print the resulting F in hexadecimal...
mercilessly reused. In the `main()` function there's even a nice little
identifier first used as a global and then reused (shadowed) in the *same*
scope, and this did not produce even a little squeak of a warning from the
compiler! Macro compression is rather sparingly used, however magic numbers
abound everywhere, and bit twiddling is magical too. Do you know for example why
we have `unsigned F=-1` ? (No warning there of course :) Hint: Later in the
program you have `F/=17`. Did that make any sense? Further hint: print the
resulting `F` in hexadecimal...
And yes, the layout hint involves a mix of the most trendy typographical
character juxtaposed against a very ancient one, Not to mention the program
character juxtaposed against a very ancient one, not to mention the program
includes some famous name dropping and documents itself as usual.
### Further spoilers, engineering, and obfuscation galore:
Those wait for you, curious and intrepid reader, in the attached
@@ -216,7 +237,8 @@ bigger constants, so it can zoom up to level 1024 if memory allows, and it tries
its best to avoid dumping core on the poor user when its memory runs out, rather
it enters freeze mode where you can still travel in calculated frozen
space-time. Well, it's not nice and tame, it even has an escape key, usage
message, and to top it all it even avoids gets!
message, and to top it all it even avoids `gets(3)`!
### Special thanks: