Skip to content
David Clamage edited this page Jun 24, 2016 · 5 revisions

Day 1: We have reached what seems to be the final in a series of puzzles guarding an ancient treasure. I suspect most adventurers give up long before this point, but we're so close! We must press on!

Yes, we find a journal. It describes the next puzzle in another creative writing format, but here are the major points:

  1. There are rooms laid out in a grid
  2. One room has an orb, another room has a vault.
  3. You bring the orb to the vault to unlock it.
  4. The orb starts at a certain value, and changes as you move around the rooms.
  5. Rooms will either have a number or an operation. They are spaced out every-other room, so as you move around you're essentially writing an equation which becomes the current value of the orb.
  6. You need to get the orb to the vault with it being a specific value.
  7. You need to do this in as few moves as possible or the orb will disappear before you get there.
  8. You cannot revisit the orb room or leave the vault room after entering it without starting over.

After some scouting, I fill in this information:

 * |  8 |  - |  1
 4 |  * | 11 |  *
 + |  4 |  - | 18
22 |  - |  9 |  *

Orb is bottom left, Vault is top right.

At this point Trevor and I have a difference of opinion. He thinks he can just figure it out by using a strategy, and I think that before he gets that, I can write a program to brute force solve it and give us the answer. Shall we see who wins?

I decide on a recursive implementation for the solver. There are a couple end conditions which should help keep the tree pruned.

  1. Revisiting the start square
  2. Ending up on the vault square

However, this wasn't enough. I decided to put an arbitrary cap on path length, and then I would increase it if no correct path was found. Luckily, around this time, Trevor found a path with 18 steps. There's my maximum! Unfortunately for him, 18 was too long and the orb fizzled before he could finish. He went back to try to find a shorter path.

He eventually finds a path that's 16 long, but my solver ends up finding the right answer with a 12 step path.

The code's a bit long to paste into this wiki, but here's a part of the recursive function to give an idea of how I solved it:

std::vector<Point> left, right, up, down;
if (loc.x > 0)
{
	left = shortestPath(Point(loc.x - 1, loc.y), myPath);
}
if (loc.x < 3)
{
	right = shortestPath(Point(loc.x + 1, loc.y), myPath);
}
if (loc.y > 0)
{
	up = shortestPath(Point(loc.x, loc.y - 1), myPath);
}
if (loc.y < 3)
{
	down = shortestPath(Point(loc.x, loc.y + 1), myPath);
}

int lSize = left.size() > 0 ? left.size() : INT_MAX;
int rSize = right.size() > 0 ? right.size() : INT_MAX;
int uSize = up.size() > 0 ? up.size() : INT_MAX;
int dSize = down.size() > 0 ? down.size() : INT_MAX;
if (lSize <= rSize && lSize <= uSize && lSize <= dSize)
{
	return left;
}
if (rSize <= uSize && rSize <= dSize)
{
	return right;
}
if (uSize <= dSize)
{
	return up;
}
return down;

== Vault ==
This vault contains incredible riches! Piles of gold and platinum coins surround you, and the walls are adorned with topazes, rubies, sapphires, emeralds, opals, dilithium crystals, elerium-115, and unobtainium.

Things of interest here:

  • mirror

Looking at myself in the mirror, I get a code! Huzzah!!

Invalid code.

Oh no... not this again.

But wait, I'm looking at it in a mirror. And conveniently, the code is only made up of letters that are mirror reversable into either themselves, or another letter, such as W, X, q <-> p, d <-> b. So, I reverse the code and adjust the letters, and voila! 8/8 codes complete!

Congratulations; you have reached the end of the challenge!

10. Conclusion

Clone this wiki locally