Prompt displays a message and asks the user to type a selection, making it useful for simple multiple-choice interaction in a browser-hosted game flow. section 14.2
Here it is wrapped in a choose function that prints numbered options, reads the typed number, retries once on invalid input, then throws if no valid choice is made. section 14.2
Multiple-choice question
A question like “Who is the greatest superhero of all time?” pairs prompt with an options array and returns the chosen index.
Choose the Door flow
The game builds door labels from prizes, shows them through prompt, then uses the returned index to open the selected door with the player’s key. section 14.2
