Menu

Measuring Puzzle Difficulty With Random Play (12 Mahjong Layouts)
📰

Measuring Puzzle Difficulty With Random Play (12 Mahjong Layouts)

DEV Community: html·Instant Games·about 13 hours ago
#8XlmQaBt
#devto2#devto#dev#layout#layouts
Reading 0:00
15s threshold

How hard is a puzzle level? Tile counts are a poor answer. A 144-tile layout can be gentler than a 100-tile one if the shape is forgiving. When I added 12 layouts to Instant Mahjong Solitaire, I wanted a number that tells players and me something real.

This post is about one cheap trick: measuring difficulty with random play.

The layouts

The game has 12 layouts, from 60 to 144 tiles: Harmony, Garden, Phoenix, Pyramid, Pagoda, Crane, Lotus, Butterfly, Dragon, Turtle, Bridge and Mountain. They differ in height, symmetry and how many tiles start locked under others.

Every deal is generated so that a winning path exists. That removes "impossible" from the equation, which leaves a different question: how easy is it to find the path?

The random-play bot

The measuring tool is almost embarrassingly simple.

// simplified sketch function randomPlay ( board , rng ) { while ( true ) { const moves = freePairs ( board ) ; if ( moves . length === 0 ) return board . isEmpty ( ) ; // cleared or stuck board .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.