Lurker News
Hello, HN! Figure is a little side project I’ve been working on. Someone described it as Bejeweled meets Wordle.

I built the puzzle interface and website in Next.js and React, which was a first for me and overall a great learning experience. The daily puzzle data is queued up in a PostgreSQL table. Another table stores anonymous solve stats. Once a day, a cron job hits a serverless API that promotes the next puzzle as “live” and prompts Next.js to update the prebaked static site with the new data. The game state is managed with Redux and your stats are persisted to localStorage. Framer Motion for animations. Styling is mostly Tailwind CSS. I use Figma for design and Logic Pro to make the sounds.
I get a lot of questions about how the puzzles are generated. It’s not super sexy. I generate random grids of tiles and then run them through a brute force solver (sounds rough but the puzzles don’t feel anything). Every few days, I play through puzzles that look promising based on the solution space and pick some good ones to go into the queue. The rest are sent back to the void (again, painless).
I’ve spent a little bit of time tinkering with a procedural generator, but so far the random ones are better. The downsides of the random approach are (1) the curation effort required, and (2) the high variability in puzzle difficulty. I have a feeling there’s a whole body of math and CS knowledge where Figure is an example of something that I don’t know the name for (imposter syndrome intensifies).
As for the future of Figure, I feel strongly about keeping it free of ads, login walls, in-app purchases, or anything else that infringes on enjoyment or privacy. I’d also like to make sure Figure is accessible to everyone. English isn’t exactly required to play, but translations for the UI and website would be nice. I’ve tried to build Figure to be friendly to people who have color vision deficiency and people who rely on screen readers and keyboard navigation, but I have no idea if it’s actually any fun in these cases.
Here are some miscellaneous thoughts…
1. It’s been surprisingly satisfying to build a web game with a modern frontend stack. I’ve noticed a lot of grumbling on HN over the years from OG web developers who yearn for the days of semantic HTML, a sprinkling of CSS, and vanilla JS. I was in that boat too and have grumbled plenty about the breakneck pace of frontend evolution. One of my goals with this project was to pick some popular frameworks and give them an honest try. I’m now a believer, but there’s still no way I can keep up with all the progress.
2. I found Tailwind awkward at first, but after a while I realized I was using Figma a lot less and just designing in code with utility classes, which is great for focus and flow. Having lived through the Web 2.0 standards revolution, it was hard to let go of some deeply rooted opinions about semantic purity, but overall I’m sold.
3. I really love side projects. At most jobs, you’re pushed toward specialization. Side projects allow you to build out a generalist skillset, which makes you better at your core job function and better at collaborating with others. It’s also liberating to explore and pivot around without time pressure. Figure started out as a 3D fidget toy in Unity where you fling projectiles at floating objects…
4. I made this game on my trusty 2013 MacBook Pro, which has been almost completely sufficient (ahem Docker ಠ_ಠ). I’ll probably get an M2 Air soon, but I’m reluctant to say goodbye to the best computer I’ve ever owned.
5. I’m very grateful for the people who build and maintain open source projects. It’s also delightful how many paid services offer generous free tiers to let developers play around: Figma, GitHub, Vercel, Supabase, and Pipedream, just to name a few that I’m currently using actively. If you work on FOSS and/or these excellent platforms, thank you.
Anyway, hope you like it. Happy to answer any questions.

Comments (113) 34 threads

Show all comments

Showing thread 1 of 34

jrh2063 replies#
11 moves felt like too many. I made my first moves without thinking ahead, and before I knew it, I’d accidentally solved the puzzle on my first try. I felt that the puzzle lacked that elegant “idea” at its core that makes a good puzzle great. (Just my personal opinion)

That said, the visual design is beautiful, and it’s inspiring that somebody was able to create this.

rsaz2 replies#
I think the number of moves isn’t the key stat here, just the number of tries to complete in that many moves.

I do wonder what the minimum required moves to complete a level is, but it seems it would be at least close to 11. How many moves did it take you?

jrh2061 reply#
I completed it in 11 moves and assumed that that was the minimum.
rsaz#
Ah, think I misunderstood you originally. Anecdotally, it took me a couple tries and some thought, and I felt quite satisfied when I figured it out!

I also find it takes me a few tries on puzzles like this to see if I really like them, so hopefully if you try some harder ones in the future you’ll enjoy it more.

sumul#
The minimum is 11 today. It varies by puzzle but is always the minimum for that arrangement of tiles. Assuming my solver is any good.
sumul3 replies#
I really appreciate the feedback. This is one of the main things I think about, and relates strongly to the part I mentioned about puzzle generation and difficulty variability. I do want this to feel like a consistently great puzzle.

For comparison, the median number of tries it took people to solve yesterday's puzzle (10 moves) was 7. Figure #35's median was 19 tries! Today's puzzle is definitely one of the easier ones, fwiw.
I've vaguely noticed some patterns of tile arrangements that create interesting sequences that are nontrivial but solvable if given some thought. I would love to develop a more formal system where these patterns are used to build up puzzles with more intent than the random boards I'm currently making. If this sort of thing is in anyone's wheelhouse, I'd love to hear from you.

sumul#
Will watch, thanks so much.
Closi1 reply#
The “number of tries” metric might be out if anyone else solved it like I did (ie going back to see if there was some smarter solution).

As for your comment about nontrivial puzzles - absolutely! 100% agree - the joy in a lot of puzzle games like bejewelled is unexpectedly clearing half the board with a clever move!

sumul3 replies#
Not sure exactly what you mean. It only logs the number of tries for your first solve, but you can keep playing around with it after that without affecting your stats (or the global stats).

Continue this thread — 3 replies

freediver1 reply#
This was a great read, thanks for posting. Would like to see similar quality article for solution to similar problems using genetic algorithms.

Continue this thread — 1 reply

sumul#
This is excellent, thanks for sharing. My solver is designed to find every possible solution so that I can evaluate the ratio of "best" solutions to all solutions. A lot of these optimizations are super interesting, but since I'm intentionally going for comprehensive brute force (rather than finding any winning solution as quickly as possible), they're mostly off the table, at least as long as puzzles are randomly generated and I need to filter them based on solution space characteristics like this.

I did realize while reading this that I could get a little more sophisticated by finding out the number of moves in a best solution using an aggressively optimized fast solver. If that number is within a range that's fun to play, say 8-11 moves, then go ahead and find all the rest of the solutions with the maximum brute force. If not, then just scrub the whole thing since I wouldn't use that puzzle anyway.

crazygringo1 reply#
Either you got really lucky or I'm really dumb :) -- because it took me a solid 6 attempts to solve the game. No matter what I started with, I always had 1 piece left over on all previous 5 attempts.
t_mann#
today's puzzle? I find it hard to fail unless I explicilty try. I can see but two dependencies in there (you need to connect the diamonds on the left and the circles on the right), and both are very easy to spot (one of them you're very likely to resolve even if you just click around).

Edit: ok, there are a few more dependencies, but they really easily resolve on their own.