Google likes to hide little jokes, known as Easter eggs, in its search results. Sometimes they’re all in fun: Look what happens when you search for the word “askew.” But Google engineer Peter Dolan created an Easter egg around the well-known computer simulation, Conway’s Game of Life. It turns out to be a pretty deep metaphor for Google and the Web itself. Dolan generously sat down to tell me how he did it.

ReadWriteWeb: How did you realize Conway’s Game of Life would be a good Easter egg for search?

Peter Dolan: I started working on it in my 20% time. [Google encourages its engineers to spend 20% of their time working creatively on projects of their choice.] I had been talking about it with some friends here at work. It’s something we all play with when we’re just starting programming. I couldn’t get it out of my head.

I was looking around on the Internet trying to find simulations so I could play with it, but I couldn’t find any that I could work with. And I thought, “Oh, well, we should have a Web box — you know, the little box above the search results.

So I started working on that, and it was pathetically small, so I thought, “Okay, why don’t I take over the whole search page? It’d be more fun.”

So I made a demo and started showing my co-workers what it was and realized that some of them had never seen the Game of Life before. I found myself spending most of my day with it running in the background, just watching it.

RWW: Tell us about programming the Game of Life. The rules of the game are simple, but computing them efficiently is incredibly complex. How did you get it to run instantly on a Google search page without a hitch?

PD: The problem with the Game of Life is, say you have a very simple simulation of it, and you’ve got a 100×100 grid. To compute the next state of each cell, you need to consider the previous state of each of its neighbors. So you need to do eight computations for each of the previous states, and you need to copy the entire game, which takes a lot of memory. So it’s expensive in time and in memory.

My first implementation of the Easter egg, if you ran it on a Windows computer, it would monopolize the entirety of the computer’s CPU. The only thing the computer could do was run the Game of Life, and it was running it slowly. Part of what I was doing in the two months I was working on it was making it pretty, but a big part of it was making it so that instead of it being everything a modern computer could do to run it, making it so that it would take half a percent of your CPU to run it.

We certainly don’t want to make it so that whatever’s going on in the background of the search page takes so much of your computer’s power that it can’t click on a search result.

RWW: So it took two months to do this?

PD: It’s not a trivial problem. It’s tricky. I’m quite proud of the way I did it. I can’t talk about the way we actually implemented it. (laughs)

RWW: What about the visual aspect of it? The fact that it’s sort of foggy and lifelike, and it doesn’t just look like solid blocks. Why did you make it look the way it does?

PD: It did take my artistic bone. It was fun! A lot of what happens in Google is, you know someone who can help. I’ve worked with a couple designers in search before, so I made my first implementation and then walked down the hall and said, “Hey, look at this for five minutes, and I’ll give you a beer.” And they said “Oh, I would change this and this and this.” And then I came back a month later and said, “I’ll give you another beer if you look at this for five minutes.”

RWW: Is this how most Easter eggs come about? Somebody gets fascinated with something, generates an idea and starts passing it around?

PD: Yeah, pretty much. I think some other ones, like if you search for “askew” and the page is slightly tilted, I think that was almost like when you think up a one-liner in your head and tell everybody every day the bad joke that you thought of. [Mine] is maybe a little bit more nerdy.

But it’s very much like that. Some engineer gets some idea and can’t stop thinking about it, and they make it happen, and everyone says, “Oh my god, that’s amazing!” And then it goes out.

RWW: How high up does an Easter egg proposal have to go? Can you just check it in and surprise everybody? How serious of a thing is it at Google to make a change to search like this?

PD: Making a change to search is always a serious thing. We try not to make changes to queries that have high volume on them. The search page is sacred. But for this one, it goes up and [Google Fellow] Amit [Singhal] takes a look at it, and it was basically like, “Hey, Amit, look what I did.” And he was like, “Oh, that’s awesome!” So there is executive review as in the five-second, “Oh, that’s awesome.”

RWW: Is the Game of Life a Google-y thing to you? Does it relate to how you think about information on a day-to-day basis?

PD: You can see it relating to Google’s core principles in a few ways. Conway’s Game of Life is these very simple rules that create a fantastically complex world that you can study and explore for years.

If you think of the PageRank algorithm [that Google uses to rank its search results] applied to the World Wide Web, it creates an explosion of knowledge, making the Web useful, something you can actually access. In some ways, that simple rule was responsible for the last decade of the Internet’s usefulness, without which we would be much poorer as a species.

Also, one of the things I really like about this Easter egg is that it introduces people to the Game of Life. It’s often seen when you’re just starting to learn programming. I remember when I was 12, and I was reading Learn C++ in 21 Days or 30 days, or whatever the book was, and the first thing you do is type the “Hello, world” program. And then you say, “Okay, what next?” Conway’s Game of Life can be next because you can write it in 30 lines, 40 lines.

Then you can spend the next couple of decades improving that, because it’s an insanely difficult problem to do efficiently. But if I can introduce kids to Conway’s Game of Life…

RWW: You can get them started.

PD: Yeah. And I think Google cares about people being able to take control of their computers, computers as an aid in your life, as something you can hack on and make fun things happen with.

RWW: What do you work on in the remaining 80% of your time?

PD: I work on the search page. I’m a front-end designer. I’m not responsible for which results are shown, but I’m responsible for how they’re shown.

RWW: What are the principles that matter most to you about that?

PD: The thing that I’m most obsessed with is that everything on the page is intuitive, nothing surprises you, and that it renders instantly. It’s delightful to work on something that [over a billion] people use.

Animation via Wikimedia Commons