Я пытаюсь сделать игру Zork. Мне нужна помощь, чтобы выяснить, как получить пользовательский ввод на протяжении всей игры.
const readlineInterface = readline.createInterface({
input: process.stdin,
output: process.stdout});
function ask(questionText) {
return new Promise((resolve, reject) => {
readlineInterface.question(questionText, resolve);
});
}
start();
async function start() {
const welcomeMessage = `182 Main St.
You are standing on Main Street between Church and South Winooski.
There is a door here. A keypad sits on the handle.
On the door is a handwritten sign.`;
let answer = await ask(welcomeMessage);
//What do I put here to get input from the user repeatedly after ever command?