Design Thinking

Something that's become more apparent as I've been mentally playing the randomly generated maps is that the number of colours buildings come in plays a key role in level difficulty. The more different colours buildings are, the easier it gets since there's less duplication of buildings throughout the map saying "Turn Left when you pass a YELLOW building" refers to fewer buildings. I've been increasing the number of building colours as things go on, but this realization has led to a bit of an explosion of colours.

That out of the way, I started really trying to apply the turning rules, and ran into a problem...

Design Catastrophe

The way things work now the player considers the buildings just passed to make a turn. Here's a segment of our map:

For our purposes we'll say that the only rule the player is following is "Turn LEFT when passing a YELLOW building".

  1. The player travells from 0,1 to 0,2 travelling down
  2. Code considers 0,2 and 1,2, discovers a yellow building, and makes a left turn.
  3. Player travells from 0,2 to 1,2
  4. Code considers 1,2 and 1,3, discovers a yellow building, and makes a left turn.
  5. Player travells from 1,2 to 1,1
  6. Code considers 1,2 and 2,2, discovers a yellow building, and makes a left turn.
  7. Player travells from 1,1 to 0,1
  8. Code considers 1,1 and 1,2, discovers a yellow building, and makes a left turn.
  9. Goto step 1

As soon as you make a turn towards the colour of building that invoked the turn you're stuck in an endless loop of circling that building.

Options

I can see two ways out of this mess:

  1. Remember which building invoked the last turn, and ignore it for the next turn
  2. Rather than considering which buildings you just passed, consider the two buildings you've just approached when making a turn.

I'm a fan of #2. Directions like "When you get to the Yellow building turn left" make sense (possibly more sense than "when you finish passing the yellow building turn left"). I also think avoiding exceptions makes sense when you can do it, and "Turn left when you pass a yellow building, unless that yellow building is the reason you just turned" counts as an exception.

Now it's time to rewrite all my rules for which buildings to consider :)

Photo by Bakr Magrabi from Pexels