Imagine this: You’re outside, standing in line of your favorite bakery, and spot a QR code in the window of the store. You don’t care about the code itself, but pull out your phone anyway, open the Game of QR app and point your phone’s camera at the QR code. On the screen, it switches from the camera view to a 2D/flat version of the code, which starts animating using the rules of Conway’s Game of Life
- Any live cell with fewer than two live neighbours dies, as if by underpopulation.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overpopulation.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
If you’re not familiar with this zero-player game, here’s a sample from Wikipedia:
And a screenshot of my own implementation from 2020, which I called “Game of Ghosts”:
Now imagine the AR (augmented reality) version: Still pointing the camera at the QR code, but now the animation happens in place, with the same perspective, instead of a reproduced 2D copy.
To make it more interesting, QR codes and their Game of Life states are collected in a gallery with geolocation. That way users of the app can collect QR codes, sharing the ones with interesting lifeforms.
Wikipedia has a nice overview of QR codes, including all 7 variants. I had no idea so many exist – some even have color.
I’m still interested in learning more about React Native, so that’s where I’d start. The camera access should be possible with Expo, which would allow for a very low barrier to get started with development and testing. That also makes it easy to do beta testing, since there’s no need to upload and install apk files.
Implementing Game of Life itself is rather easy, which is probably why its a popular programming exercise. My CLI version implemented with node.js runs on replit.com.
I expect the difficult part to implement for Game of QR is to read the raw QR code as a 2D data structure, without decoding it. I assume QR code scanner libraries will include the decoding. At least the documentation for https://github.com/moaazsidat/react-native-qrcode-scanner doesn’t show how to access the raw data. Maybe the decoded data can be turned into a new QR code, which is then used to seed the Game of Life.
Let me know if you’re interested in collaborating with me on this idea!