summaryrefslogtreecommitdiff
path: root/lambda-calcul/javascript
diff options
context:
space:
mode:
authorEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 22:43:00 +0100
committerEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 22:43:00 +0100
commitcbc3ebfca24c89c475b9970fa525055d8291ee88 (patch)
treea190fc4afb3fdcfb1c7a35262206ee06421aba14 /lambda-calcul/javascript
parent2ac732dc527d53974d65a5afbb33c452a567797b (diff)
downloadlambda-nantes-cbc3ebfca24c89c475b9970fa525055d8291ee88.tar.gz
Loop until failing one challenge
Diffstat (limited to 'lambda-calcul/javascript')
-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!`));