Planarity is a puzzle based on the concept of Planar Graphs.
Live at: asmitahase.github.io/planarity
A planar graph is a graph that can be drawn on a 2D plane such that the edges intersect only at the vertices. The goal of the puzzle is to untangle the graph to reveal its planar nature.
The game uses John Tantalo's algorithm to generate planar graphs.
- Generate a set of random lines in a plane such that no two lines are parallel
- Calculate the intersections of each pair of lines
- Mark the intersection points as vertices and segments as edges of the graph
The vertices of the graph are then randomly shuffled maintaining the topology to get the final puzzle piece
- Player will be presented with a planer tangled graph at level 4 at the beginning
- Move the nodes with a pointing device to untangle the graph and reach the next level
- jQuery for DOM manipulation
- Tailwind to rapidly build UI elements
- Graph.js to draw graphs on HTML canvas
This project is free and open-source under the GPL-3.0 License.