# Maze Solving (for real) and Code Tracing

Every year for the past sixteen we venture down to Lancaster Pa. for a weekend of car camping. Actually, there's not much camping anymore. I used to be a bit more hardcore having done a few sections of the Appalachian Trail in my youth. Now, as I've gotten older I've come to appreciate little things like air conditioning, showers, beds, and toilets. So, nowadays we usually try to get a cabin at a camp site. I get my amenities but we still get a campfire and s'mores.

We mostly come down for Cherry Crest Farm's corn maze. We first did it when the kid were little. It sounded a little hokie but everyone keeps enjoying it so much we keep coming back. They've got a big maze - over 5 acres. Each year it's a different theme. This year was in honor of the moon landing.

The maze is split up into 15 sections in a 3 x 5 grid. When you start you get an empty game board. As you work your way through the maze, you find these mailboxes each containing a section of map. You can also see what the overall maze picture looks like and how it's sectioned off. The maze usually has a handful of major graphical components and each is enclosed in colored tape. For instance the moon might be surrounded by yellow tape and the astronaut in black. In the image above, the wheels of the tractor might be taped in one color and the cabin another.

For the ultimate challenge you have to find all fifteen pieces, answer a bunch of questions in a crossword (where the answers are strewn throughout the maze) and find your way to the exit. It usually takes us about an hour and a half. There are also a bunch games, mini activities, and even a cafe in the middle.

Since we're a CS family we joke about how to solve the maze - left hand rule, breadth first search, iterative deepening etc. At times, we actually do use a mini breadth first routine. There are four of us, when we get to an intersection, we split and explore down to the next decision point. If two people made it to that decision point, we might split again. I guess it's a mini combo of breadth first and iterative deepening since we never stray too far from our anchor point.

Over the years, I've also thought about how we handle solving the maze in terms of approach and temperament - particularly as it gets hot under the sun and we start to get hungry. The other week when I read Cunningham, Ke, Guzdial, and Ericson's article from ITiCSE 2019 about sketching and tracing code I started thinking about some parallels, most notably the idea in the paper that the novices questioned trace for patterns and goals rather than strictly tracing programs all the way through - that rather than "being the computer" they trace less formally until they think they see the pattern and how it will lead to a goal. The paper notes that this is in spite of the fact that this type of tracing doesn't seem to yield better results.

When we start the maze we usually just wander. The logic is that no path is going to be better than any other so we'll probably run into a mailbox or two. These are our explorations like an initial look at the code. Then we get systematic. We look at the map piece we just found and try to figure out which path to take next. If we hit an intersection we try to logic which path is best. We use all our info - map pieces, what the overall maze looks like, the sectioning tape, other landmarks, and even any visible maze edges. This is like the formal code trace where the student is still going through the trace in detail.

Then, our search degenerates. We get cocky - we know what the maze looks like so we wing it. This is when the student thinks they know the intent of the code so they can now figure out the answer. Invariably, we're wrong.

Ultimately, we get hot, tired, hungry and a little grumpy. Fortunately, we now recognize this and it's our sign to look at our map and start being smart again - do the formal trace.

Once we get to this point we usually finish pretty quickly. We figure out the best way to get o sections we haven't visited, find those pieces and then the exit. Once done, it's off to Good'N Plenty to re-hydrate and eat way too much food.

I don't know if any of this means anything but it's some food for thought. Maybe there is something to look at in human general problem solving practices and not just classroom or computer science ones. Who knows.

In any event, get down to Lancaster PA if you can and check out the maze. It might be hokie but it's a lot of fun.