Draw a Perfect Star
- 3 Devlogs
- 2 Total hours
An online challenge to draw the perfect star! Inspired by neal.fun.
An online challenge to draw the perfect star! Inspired by neal.fun.
The goal of this system is not to “recognise” a star visually. It turns both your drawing and a perfect star into comparable point data, then measures how far apart they are.
This makes scoring fast, deterministic, and surprisingly stable.
While you draw, the app records raw mouse positions:
path = [(x1, y1), (x2, y2), etc etc]
This data is noisy and depends heavily on speed and polling/sampling rate.
The stroke is converted into a fixed number of evenly spaced points (120).
This removes:
drawing speed differences
uneven mouse sampling
Now every drawing has a consistent structure.
The shape is transformed so comparison is fair:
centred around (0, 0)
scaled so max radius = 1
This removes position/size- only shape remains.
A perfect 5-pointed star is generated mathematically using polar coordinates and sine-based radius switching.
It is also sampled into 120 points so it matches the user format.
Each user point is compared directly to the corresponding star point-
error += distance(user[i], star[i])
This produces an average geometric deviation across the full shape.
Final score is computed as:
score = 100 - error * 120
Then clamped between 0 and 100.
The system works by converting both shapes into normalized point sequences and measuring their geometric distance.
deployed a prototype build of “draw a perfect star” to github pages! also made it look a little nicer lol :p
Built a first prototype for my “draw a perfect star” online game! Like if you could do better than me LOL