FS#6616 - rocklife: Conway's Game of Life

Attached to Project: Rockbox
Opened by Matthias Wientapper (mattzz) - Friday, 02 February 2007, 22:11 GMT
Last edited by Antoine Cellerier (dionoea) - Friday, 29 June 2007, 19:40 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This is rocklife, Conway's Game of Life, a completely pointless plugin :-P

"The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
The "game" is actually a zero-player game, meaning that its evolution is determined by its initial state, needing no input from human players. One interacts with the Game of Life by creating an initial configuration and observing how it evolves." (Wikipedia)

The initial configuration is a random pattern. The grid is computed modulo (i.e. exceeding a border means entering it on the opposite side). The age of a cell is shown by its colour.

* Play/Select: Next generation
* Up: Play/Pause
* Down: re-initialize grid
* Power: quit

This task depends upon

Closed by  Antoine Cellerier (dionoea)
Friday, 29 June 2007, 19:40 GMT
Reason for closing:  Accepted
Additional comments about closing:  Applied. Thanks.
Comment by Matthias Wientapper (mattzz) - Saturday, 03 February 2007, 01:14 GMT
- Added selectable start patterns (random, acron, growth_1, growth-2 - choose with button down)
- fixed bug in mode/button management
- added status line, showin generation count and population (activate with button left)
- re-defined buttons:
pla_fire: run/pause
pla_right: step
pla_down: select start pattern
pla_left: toggle status line
Comment by Paul Louden (darkkone) - Saturday, 03 February 2007, 06:32 GMT
I'm not sure but there may be a bug.

Static things fade to white, I assume this is intentional.

Oscillating things fade to white, and then suddenly vanish. I'm assuming the vanishing is not supposed to be intentional, when the static things get to hang around, is it?
Comment by Matthias Wientapper (mattzz) - Saturday, 03 February 2007, 11:38 GMT
> Static things fade to white, I assume this is intentional.

yes, this is intended.

> Oscillating things fade to white, and then suddenly vanish.

They should not. This is a bug, probably driven by an overflow of the "unsigned char age" value.

I will have a look into this - thanks for the feedback.
Comment by Matthias Wientapper (mattzz) - Saturday, 03 February 2007, 12:05 GMT
Fixed vanishing of oscilating things. I attached a new patch file.
Comment by Dominik Riebeling (bluebrother) - Saturday, 03 February 2007, 12:47 GMT
Your latest patch doesn't compile for h120 -- you check for LCD_DEPTH > 1 but use the color functions in that case, missing the fact that there are non-color devices with a depth greater than 1.
The attached patch changes this, it also uses greyscales on greyscale targets. This might make the result a bit "lighter" as there is no different background color. Haven't checked this though, the result looks ok from a first look. Also included the needed change to the SOURCES file (which was missing in your patch)
Comment by Michael Sevakis (MikeS) - Saturday, 03 February 2007, 13:45 GMT
Lol. I was planning on converting the GOL screensaver I wrote eons ago to rockbox. :P Guess you've taken on this responsibility.

I did do my coloring by neighbor count though. Look forward to seeing the effect of using age.
Comment by Matthias Wientapper (mattzz) - Saturday, 03 February 2007, 21:09 GMT
- optimized algorithm, improved speed
- added "glider gun" start configuration
- fixed 2bpp handling
- checked on ipod video, nano, h120 simulators
- checked on ajr, sansa hardware
Comment by Paul Louden (darkkone) - Friday, 09 February 2007, 02:32 GMT
A note: You should have the plugin display on a clean background. Right now it displays on top of whatever background image is set. This can make it impossible to use if you have a black or dark background image.
Comment by Matthias Wientapper (mattzz) - Saturday, 10 February 2007, 21:28 GMT
- Fixed the backdrop/bg_color initialization
- backlight stays on now
Comment by Oleg G (MadCow15) - Thursday, 15 February 2007, 02:28 GMT
I don't really understand how the button configuration works, but it doesn't let me do anything apart from start/stop with my Gigabeat. Could you explain how to edit the button mappings?
Comment by Matthias Wientapper (mattzz) - Thursday, 15 February 2007, 18:39 GMT
On Toshiba Gigabeat you should be able to start/stop GOL by pressing the middle button of the cursor cross.
Cursor down selects start pattern, cursor left toggles status display and cursor right does a single step (when stopped).
Pressing "A" quits the plugin.

At least that's what works fine in the simulator.

What exactly is it what you are missing?
Comment by Oleg G (MadCow15) - Thursday, 15 February 2007, 20:46 GMT
Sorry my mistake. I just tried it again and found out that the other buttons only worked when GOL is paused.
Comment by Pascal Briehl (ColdSphinX) - Monday, 19 March 2007, 16:14 GMT
synced to svn
Comment by Antoine Cellerier (dionoea) - Thursday, 28 June 2007, 21:33 GMT
Nice :) (but completely useless ... :p) Anyone object to applying this patch to svn?
Comment by Michael Sevakis (MikeS) - Thursday, 28 June 2007, 23:52 GMT
Yes, completely plasma, mandelbrot et al. :) I had mentioned above that had I planned on writing a GOL plugin myself but got beaten to it so of course I don't object.