Project: Three Escape-Room Features

Your unreachable-puzzle report is committed, and you’ve run the whole loop once. The escape-room business now wants three more features for its designers, and this time you run the loop yourself.

This page is their brief and the steps for each. On your own project, you’ll split each feature into tasks, write the tests before the code, and check your agent’s work before you keep it. Start with the decision all three features share.

Read the Brief

All three features keep the project’s first design decision: the code checks structure, and difficulty stays with the designer. The tool adds up and compares the designer’s estimateMinutes. It never scores or labels a puzzle’s difficulty, and it never changes a room file.

Dead-End Detection

A puzzle may have an optional uses list: the items or codes from its needs that solving it uses up, so they’re gone afterward. Now the solving order matters. A team that spends a key on one lock can leave a second lock needing it, with nothing to unlock it again. That state is a dead end.

The course download adds a room with one, The Harbourmaster’s Office, in rooms/the-harbourmasters-office.json. Here’s its sea chest:

Language: JSON Filename: rooms/the-harbourmasters-office.json
{
  "id": "sea-chest",
  "name": "the sea chest",
  "needs": ["brass key"],
  "uses": ["brass key"],
  "unlocks": [],
  "estimateMinutes": 5
}

The harbourmaster’s desk gives the brass key. The lamp-room door needs it too, with the lamp code from the tide board, but has no uses, so it leaves the key in place. Open the door first, and a team can finish the room. Open the sea chest first, and the door is stuck for good.

On your own project, copy the full file into rooms/ from the course download or from here, read it, and commit it with your first setup. Code tasks leave it unchanged, like the other rooms:

Language: JSON Filename: rooms/the-harbourmasters-office.json
{
  "name": "The Harbourmaster's Office",
  "puzzles": [
    {
      "id": "desk",
      "name": "the harbourmaster's desk",
      "needs": [],
      "unlocks": [
        "brass key"
      ],
      "estimateMinutes": 6
    },
    {
      "id": "tide-board",
      "name": "the tide board",
      "needs": [],
      "unlocks": [
        "lamp code"
      ],
      "estimateMinutes": 8
    },
    {
      "id": "lamp-door",
      "name": "the lamp-room door",
      "needs": [
        "brass key",
        "lamp code"
      ],
      "unlocks": [
        "signal flag"
      ],
      "estimateMinutes": 7
    },
    {
      "id": "signal",
      "name": "the signal mast",
      "needs": [
        "signal flag"
      ],
      "unlocks": [],
      "estimateMinutes": 10
    },
    {
      "id": "sea-chest",
      "name": "the sea chest",
      "needs": [
        "brass key"
      ],
      "uses": [
        "brass key"
      ],
      "unlocks": [],
      "estimateMinutes": 5
    }
  ]
}

Three rules settle what the checker says:

  • The verdict: “Can be finished” now means that some solving order reaches every puzzle. A room can’t be finished only when every order gets stuck.
  • The report: It names each dead end, even when another order finishes the room: the puzzle that used the item up, the item, and the puzzle left stuck.
  • Rooms without uses: They behave exactly as before, so both sample rooms and the rooms in test/rooms/ keep their verdicts.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.