Implement Untangle Puzzle Game Logic
Problem: Implement the logic behind the 'Untangle' puzzle game: given a planar graph where nodes (dots) are placed at arbitrary 2D coordinates and edges connect them (with edges possibly crossing visually), determine which edges cross, and support repositioning a node to a new coordinate, re-checking whether the graph is 'untangled' (no edges cross).
Constraints: Nodes/edges given as coordinates and pairs; must detect line-segment intersections correctly (including shared-endpoint edges, which should not count as crossing).
Approach: For each pair of edges not sharing an endpoint, use the standard segment-intersection test (orientation of endpoints via cross products, covering both the general case and collinear/boundary edge cases) to determine if they cross. On a node move, only re-check edges incident to the moved node against all others rather than recomputing all pairs, for efficiency. The puzzle is 'solved' when zero edge pairs cross.