C++ implementation of building and solving a maze