// The Hollow Cottage // Chapter 5 const cottageName = "The Hollow Cottage" writeln("You are standing outside " + cottageName + ".") var playerName = input("What is your name, traveler? ") writeln("Welcome, " + playerName + ".") var tries = 0 var solved = false while tries < 3 and not solved tries = tries + 1 var answer = input("There is a riddle carved into the door. It asks: what has keys but no locks? ") if answer == "piano" then writeln("The door swings open. You step inside.") solved = true else writeln("Nothing happens.") end if end while if not solved then writeln("The door refuses to budge. You'll have to find another way in.") else writeln("The cottage is dusty but intact.") var inventory = array() append(inventory, "rusty key") append(inventory, "half-burned candle") writeln("On the floor, you notice:") for each item in inventory writeln("- " + item) end for writeln("You pick up both items.") end if