New Exercise: Maze Runner

Hi colleagues,

I want to add two exercises that allow students to practice recursion algorithms. The first exercise is generating a random maze. The second is finding a way in the maze.
You can see the implementation of these two tasks in the following repository:

These two tasks can be for all tracks. At the moment, I have prepared a PR for the AWK language.

Below is a possible intro for this task.


Bob is a lackadaisical teenager with a thing for tackling mazes but often finds himself stuck and disheartened. In this exercise, you’ll develop a program that guides Bob through the twists and turns of any labyrinth, ensuring he overcomes obstacles and retains his enthusiasm for maze-solving. Help Bob conquer the mazes with your programming skills!

In this talk from a recent Clojure conference, Alex explained various maze algorithms from the book Mazes for Programmers:

1 Like

How would one go about testing the maze generation?

Could a maze have multiple solutions?

Is there any accessibility issues with an exercise like this?

How would one go about testing the maze generation?

The test is to check that the generated Maze is correct. This means it should have the expected number of columns and rows, one entry and one exit, and the walls should be drawn correctly.

I just wrote a test that checks all of these criteria:

I agree that we still need to add a check that we have only the required number of passes and there are no extra ones. Well, I hope that it will not be difficult to add such a check.

The above test is written in the AWK language. However, it is not difficult for me to write the same test in the Java, Kotlin, or Python languages.

Could a maze have multiple solutions?

For the second task where you need to find a way in an already generated maze, there will be only one solution. Tests for this task are very simple.

As for the first task where the student needs to generate a Random Maze, then we will not have one single solution. I would like to note that for the task of generating a maze, we can use a variety of algorithms. As I mentioned in the previous post our tests will just check that the maze is generated correctly. Of course, such a test looks a little more complicated than regular tests. However, its complexity is within acceptable limits.

Is there any accessibility issues with an exercise like this?

I didn’t understand the question.

I met tasks related to generating mazes and finding the way in different programming courses. In my opinion, this task is quite simple but interesting and useful for students.

It covers topics such as random number generation and graph theory.

I think adding these exercises would greatly benefit the Exercism site.

That is Exercism rather than Exorcism. Quite a difference there! ;)


Nice catch. I’ve fixed the original post.

In any case, this topic was created to discuss the advisability of adding new exercises.

I want to note that the PR with all the necessary files has already been created. At the moment, the pull request is closed because it is necessary to discuss in advance whether these tasks need to be added to the site.

@iHiD @kytrinyx Do either of you have any thoughts on this?

Also @glennj

I love the idea of the two different exercises.

For the one you did the PR for, that’s the solving version, right? We’d probably want to have a handful of smaller mazes that work up to a complex one for this. And also be clear on the fact it’s the shortest path, etc.

I think both probably need more instruction on how to actually solve/create mazes - we want to keep the problem focussed on solving this using AWK, not just on solving an algorithm, so we should liberally give hints as to how to solve it algorithmically.

This feels like a great addition in general to me, so if AWK pps are happy to have this added to AWK then I’m happy for the PR to be reopened!