For Christmas my brother got me this puzzle:
The premise is that you have a metal medallion with a series of holes in it and a metal ring with a slit just large enough to slide it from hole to hole, barring obstacles, like the edge of the map and an obstruction near the top. The goal is to be able to remove the ring from the medallion when starting at the center hole. It was simple enough to figure out after mapping out taken paths, but after solving it, I thought it might be fun to make a solver:
I'm sure something like this has been done and is part of some Legend of Zelda-like dungeon, but I wanted a simple example to demonstrate some concepts in Angular. The Angular part took about 15-30 minutes to throw together after a longer time of working out the nodes and edges.
The Problem
My first thought was that is represented an undirected graph, so I labeled each of the 24 holes with letters A-X and recorded all of the edges as holes that the ring can travel directly between. That works, except for the obstacle (an intentionally raised point) that exists between A, B, C, and D.
In this exact puzzle, the solution is: Start,M,A,I,F,U,H,K,R,D,Q,V,J,X,P,N,B,Q,End
Applying a simple shortest path algorithm renders: Start,M,A,I,F,U,H,K,R,D,Q,End
The problem with that solution is that the exit is not reachable from Q until you have gotten on the other side of the raised point at the top, so you have to run through the little cycle of Q,V,J,X,P,N,B,Q to get around it.
I'm getting the vibe that the correct structure may not be an undirected graph or that I need to use something other than the shortest path, but I'm not sure what the terms I need to look for are going to be.
Extra Info
All of the existing edges I've found are: [["A","M"],["A","I"],["B","N"],["B","Q"],["B","P"],["C","K"],["D","R"],["D","S"],["D","Q"],["E","R"],["E","K"],["F","I"],["F","U"],["G","W"],["H","U"],["H","K"],["H","O"],["H","W"],["I","L"],["J","X"],["J","V"],["K","R"],["M","Start"],["N","P"],["P","X"],["Q","End"],["Q","V"],["T","V"]]
I was going to look into some way to plot the nodes in Angular in a way that correlated to their relative positions on the medallion, but the main problem seemed more important.