Arduboy gets a Life (Conway's Game of Life)

Probably not what would be considered a typical game for the Arduboy but…

I’ve adapted my implementation of Conway’s Game of Life, that I wrote for the Sparkfun MicroView, to run on the Arduboy.

ArduboyLife.hex (30.8 KB)

Sound is enabled in the video at time 1:42

Code and information is available on GitHub.

Since the Arduboy has a speaker, I came up with a way to add sound to the game. The number of live cells for a generation is counted to determine the frequency of the tone played. The more cells, the higher the pitch. The frequency in Hz will be live cells * 3 + 20. This gives an interesting (or maybe somewhat annoying) sound pattern :grimacing:

NOTE: This sketch double buffers the display image and therefore uses a large amount of RAM. It’s likely to be affected by a bootloader conflict problem. If you have trouble loading new sketches after uploading ArduboyLife, see this post further down in this topic:


The game of life is the greatest game ever conceived. Really awesome transition from the title screen.

Ah man, and I thought this post was about me having relevant and meaningful social interactions. Nice work though was waiting for someone to get this! :smiley:

1 Like

The sound sounds like the music in 2001 a space odyssey, when Bowman enters the monolith. :stuck_out_tongue_winking_eye:

1 Like

Looks great. Love how the opening titles become the seed!
Any chance when paused, that the direction pad + ‘Run’ button let you draw / push pixels to the screen? Alternatively I guess, you could interact with the running game and then adjust settings when paused?

I thought about doing a grid editor but don’t really have the time right now. Anyone else is welcome to take a shot at it.

The way I would do it would be to change the Up and Down buttons to not just simply toggle the sound but bring up a menu instead. The menu would allow you to toggle sound, as before, but also have options for starting an editor, perhaps saving games, etc.

My idea for an editor would be to have the D-pad move a cursor. An auto-repeat when the movement buttons were held down would be nice. The A button would toggle pixels to their opposite state and could be held down and used with the D-pad to draw lines. The B button would exit the editor.

The only problem I see is that the screen is so tiny that some may have difficulty drawing specific patterns.

I’ve also thought about being able to upload grids using USB serial (although if you have a computer that can edit grids for upload, you could probably play the game on it, making the Arduboy redundant). For upload I would have the main loop check for serial data when in pause mode. If a 0xFF was received it would signal start of data. The grid data would just be pairs of bytes containing the X and Y coordinates of each pixel, in binary. Another 0xFF would signal the end of data. The grid would be cleared and the uploaded pixels would be set. If a timeout occurred before the ending 0xFF was received, all data would be discarded. If you wanted to get fancy, you could include some kind of a checksum with the data and have the Arduboy send an ACK or NAK.

Note that because of the way the restart function is currently implemented, it couldn’t be used with the edit or upload functions.

About saving games: There obviously wouldn’t be space to save actual grid patterns, but the pseudo-random starting pattern for a game is determined by the seed passed to the genGrid() function. You could save a desired game, for retrieval and replay, by just saving the 4 byte seed, which is stored in the randSeed variable.

1 Like

This has installed in a folder and I can’t install any new games. How do I remove games so I can start fresh installs. Sorry but I’m new to this


I’m not sure exactly what your problems is. Can you be more specific and give some details?

When I complied the game it asked me if I wanted to create a folder which I replied yes. Now every time I compile a game it finishes and restarts the unit but its always the Life demo. I complied several games before this and they all worked. So I was just wondering what I need to do to remove the life demo and install new games.

Sorry hope that makes it clearer, and thanks for any help you can offer


Life uses a large amount of RAM so you may be running into the bootloader conflict problem.

Try holding down the UP button when powering up and plugging in your Arduboy. This will enter “flashlight” mode and the RGB LED will light up white and the display will remain blank. (If you have one of the later Kickstarter Arduboys, with the RGB LED installation problem then the RGB LED will not turn on, but if the display remains blank then you’re probably in “flashlight” mode.) See if you can then load a new sketch.

Thanks that worked. I really appreciate the response my son is 10 and he loves the Arduboy, nice to see him enjoy something other than Minecraft. I got this as a project so we can both learn code together

Thanks again



I’ve updated ArduboyLife to use the Arduboy2 and ArduboyTones libraries instead of the original Arduboy library.

It plays the same as before but you now get the extra boot up features that the Arduboy2 library provides.

1 Like

This is a classic game! Could you serve up a hex file? :slight_smile:

Give me a bit of time. I’d like to try and convert it from using ArudboyTones to one of the Beep classes in the Arduboy2 library, and also create a .arduboy file.

I’ve converted the game to use the BeepPin1 class included in the Arduboy2 library for sounds, instead of the ArduboyTones library. This reduced the size of both program memory and RAM, and also speeds it up slightly on speed 9 with sound enabled.

The repository now has a binaries directory containing a .arduboy file (which contains a compiled ArduboyLife.hex file).

I’ve extracted the Arduboy.hex from the .arduboy file and embeded it in the main post because I think this was @bateske’s intention when asking for a .hex file.

1 Like

You can embed .arduboy files too you know :wink:

It would just be extracting the .hex anyway though.

If using a .arduboy instead of a .hex offered the ability to view some of the information stored in the info.json or use some of the embedded images then it would make more sense to use .arduboy,
but since it doesn’t, it makes no difference either way.

Except it makes it easier for users to download the .arduboy file


Though for at least some games the file on the forum won’t be the latest version.