Software Engineer
Loading posts...
Feel free to contact me at kanishksachdev@gmail.com
I saw this little puzzle online and wanted my own copy I could open whenever, without bookmarking yet another site I'd forget. So here it is.
The goal is simple: drag the nodes around until none of the lines cross. There is always a way to lay it out flat, because the graph is secretly planar; you are just recovering a tangle-free arrangement it already has.
Drag the nodes so no two lines cross. Red lines are the ones still overlapping; get them all green to win.
The puzzle is built backwards. First it scatters the nodes and runs a Delaunay triangulation to connect them; a Delaunay graph is planar, meaning it can always be drawn with no crossings. That clean layout is the hidden answer. Then it throws every node to a random spot, and hands you the mess.
To colour the lines, the game checks every pair of edges each frame for a proper crossing (a quick sign test on the orientation of the endpoints), skipping any two lines that merely share a node. When the crossing count hits zero, you have found your way back to a planar drawing, and it throws some confetti.