sraaphorst / spelunker

Maze generation and solving library
Other
11 stars 2 forks source link

T62: Added GraphMaze class and isomorphism between Maze and GraphMaze. Refactored out typeclasses. #68

Closed sraaphorst closed 6 years ago

sraaphorst commented 6 years ago

There is now a package, GraphMaze, which uses Boost.Graph to represent thin mazes. In order to test it, I implemented the typeclasses Homomorphism from GraphMaze to Maze and vice-versa (since it is an isomorphism), and Show for GraphMaze, which just maps through the homomorphism to Maze and uses Show<Maze>.

This appears to be working fine, as verified in the test_isomorphism app, which takes a DFS Maze, isomorphically maps it to a GraphMaze, shows it (which uses the reverse homomorphism), and then explicitly calls the isomorphism to map the GraphMaze back to the Maze, and shows that. The results are consistent.

sraaphorst commented 6 years ago

I was worried that this would cause problems if the underlying graph in GraphMaze was copied, as I saw this happen without careful implementation (and multiple graphs get consecutive vertices, it seems), but so far, now, I have not been able to reproduce this.