Snapzule snap, shuffle, solve
A selfie puzzle game you play with your hands. Snap a photo with an open palm, swap the tiles with a pinch, and race the daily leaderboard.
From 2x2 up to 6x6.
Open palm, pinch, peace sign and thumbs up.
One shared scramble a day, checked by replaying the moves.
Anything quicker per swap is rejected as impossible.
No mouse. No touch.
The real game plays through your webcam. Hold up an open palm and it snaps your selfie. Then you pinch a tile, move your hand and open it to drop. This loop is a drawn replay of that, not your camera.
- 1Open palm, hold 2 seconds
- 2Pinch to grab a tile
- 3Move, then open your hand
Your hand is the controller
The camera runs MediaPipe Hands, which finds 21 points on your hand. Snapzule does not use a trained gesture model. It compares how far each fingertip is from the wrist, and that is enough to tell these apart.
Open palm
Hold still and the game snaps your selfie and cuts it into tiles.
Pinch or fist
Grab a tile, drag it onto another one and open your hand to drop it.
Peace sign
Shows the solved picture for a moment, then hides it again.
Thumbs up
On the win screen, a thumbs up starts the next round without touching anything.
A board you cannot fake
Everyone gets the same scramble each day, from a seed based on the date. A score is only accepted after the server plays your moves back and gets the solved picture. The daily leader's run is saved too, so you can race a ghost of it.
- Step 1
You solve it
The browser keeps a log of every swap you make.
- Step 2
Send the run
The seed, board size, time and swap log go to a cloud function. Google sign-in only happens here.
- Step 3
Replay
The server rebuilds the scramble from the seed and plays your swaps back.
- Step 4
Check
It must end solved, on today’s seed, no faster than 120 ms a swap, within 5,000 swaps.
- Step 5
Record
Only the function can write the daily top 100. Players cannot write scores.
Built to keep a kid busy
How it started
I kept seeing MediaPipe all over Instagram. I wanted to do something funny with it. I also wanted a cunning little game for my nephew.
A swap puzzle made sense. Nothing is hard to understand, and moving tiles with your own hand is more fun than clicking.
The bugs that were not obvious
The camera light kept blinking. The game looked fine, but the camera kept closing and reopening, about once a second. The cause was one inline function. Every re-render handed the camera component a new callback, so it thought it had to start over. The fix was to keep the callback in a ref and let the camera open once.
The leaderboard had its own surprise. Submitting a score failed with an internal error, because I had stored the ghost replay as a list of pairs and Firestore does not allow arrays inside arrays. Storing the swaps as one flat list fixed it.
Did it work?
Five whole minutes.
My nephew played it for about five minutes and I got some peace. Then it was back to annoying me.