Ruby code for creating and solving mazes