Challenge: The Unicorn’s Horn
Imagine this scene from the adventure game:
The hero Estragon arrives at a pub known as the Unicorn’s Horn. The publican asks, “Do you need to stable a steed?”
“No,” Estragon replies, “I have no steed. But I do have 50 gold pieces, and I would like a drink.”
“Excellent!” says the publican. “I have mead, wine, and LaCroix. What will you have?”
For this challenge, add below your hasSteed variable the variables required for the scene at the Unicorn’s Horn, using type inference and assigned values where possible. Add variables to hold values for the name of the pub, the name of the current publican on duty, and how much gold the player has acquired so far.
Notice that the Unicorn’s Horn has a menu of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access