summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lambda-calcul/javascript/index.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lambda-calcul/javascript/index.js b/lambda-calcul/javascript/index.js
index d8b5e68..ef77fea 100644
--- a/lambda-calcul/javascript/index.js
+++ b/lambda-calcul/javascript/index.js
@@ -16,7 +16,8 @@ const solveNextChallenge = (token) => client
.then(challenge => console.log(`Next challenge: ${challenge}`) || challenge)
.then(client.solve)
.then(solution => console.log(`Posting solution: ${solution}`) || solution)
- .then(solution => client.postSolution(token, solution));
+ .then(solution => client.postSolution(token, solution))
+ .then(() => solveNextChallenge(token));
const waitForEnterToBePressed = () => {
const readlineInterface = createInterface({
@@ -24,7 +25,7 @@ const waitForEnterToBePressed = () => {
output: process.stdout,
});
- return readlineInterface.question(`Done. Press Enter to unregister ${playerName}.`)
+ return readlineInterface.question(`Press Enter to unregister ${playerName}.`)
.then(() => readlineInterface.close());
};
@@ -34,6 +35,7 @@ client.start()
console.log(`${playerName} has registered with token ${t}`);
})
.then(() => solveNextChallenge(token))
+ .catch(() => console.log("Oops!… Didn't get this one."))
.then(() => waitForEnterToBePressed())
.then(() => client.unregister(token))
.then(() => console.log(`${playerName} unregistered!`));