About a week ago, I decided to implement Conway’s Game of Life in Go. There was no particular reason, other than that I was bored, I wanted to do something else with Go, and I had never tried to implement Life before.
For those who don’t know, Life is a zero-player “game” in which an ecosystem is seeded, and then plays out all by itself. Once begun, each generation follows these basic rules:
- Any live cell with fewer than two live neighbors dies, as if caused by under-population.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any live cell with more than three live neighbors dies, as if by overcrowding.
- Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
That’s it. You start it up, and then sit back and watch for patterns to emerge. So far, I have a version that uses a portable curses-like library for console graphics. It runs on OSX, and should definitely run on Linux. The page for termbox-go says that it will run on Windows, but I haven’t tried it. I plan to build a “prettier” version using Gtk+, but that will take a little while, since I don’t know Gtk+ (yet!).
Here’s a screenshot of the current version running:
If you want to see the code, it’s on github.
Posted in tech
Tagged conway, go, golang, life
From today’s edition of the Now I Know newsletter, this bit of interesting stuff:
In ordinal rank, the ace in a deck of playing cards is lower than the two — it’s the one, after all. But in most card games, the ace plays as the high card, trumping the King. Why? According to Wikipedia, this use became popular after the French Revolution, with the ace symbolizing the rise of the commoner over the monarchy.
Tonight I gave a lecture to the Atlanta Go User Group called “Go: Beyond the Basics.” Here are the slides from that talk:
and here is all the sample code that I showed, and here’s a PDF of the slides, in case you’d rather have that.
Do you play the ukulele? Have you always wanted to? Do you live in or near Atlanta, GA? The Southeast Ukers are a group of ukulele players who get together twice a month to play and sing together. We meet at the Waikikie Hawaiian BBQ restaurant on the 1st and 3rd Sundays of each month. It doesn’t matter if you’ve been playing for 20 years, 20 minutes, or just played air uke in the shower, we would love for you to join us.
For more details, check out our Meetup.com group
This commercial cracks me up every time. This is the longer version, too.
Thomas said I kicked the board so hard it bled. But the blood on this board is my own. I was channeling Jackson Pollock.
I am now officially a 1st Dan in Taekwondo. w00t!