aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbraxtonhall2022-11-30 20:23:26 +0000
committerbraxtonhall2022-11-30 20:24:32 +0000
commit07abc8709a5dd0082e699c749418b617d6fc3d3b (patch)
tree1b68ad62fa619b2847b325cd6c793484400c357b
parente5081339ca952c0c55cf12cef48d6f6f9e0bc05c (diff)
Minor cleanup for the actual exhibition
-rw-r--r--entries/braxtonhall/hitl2/fib.js25
1 files changed, 19 insertions, 6 deletions
diff --git a/entries/braxtonhall/hitl2/fib.js b/entries/braxtonhall/hitl2/fib.js
index e050d96..429abc2 100644
--- a/entries/braxtonhall/hitl2/fib.js
+++ b/entries/braxtonhall/hitl2/fib.js
@@ -139,11 +139,24 @@ const number = () =>
: slow(hedge()).then(() => slow(innumerable())).then(number)));
const choose = () =>
- prompt("would you like to use my iteration optimization??? yes????")
- .then((response) => ["y", "yes"].includes(response.trim().toLowerCase()))
- .then((should) => should
- ? fast("yes!").then(() => hitlfibiter)
- : fast("oh.").then(() => slow("okay.")).then(() => slow("we can take it slow.")).then(() => hitlfib));
+ prompt("would you like to use my iteration optimization??? yes???? .. or.. no?")
+ .then((response) => Promise.resolve(["yes", "no", "y", "n"].includes(response.trim().toLowerCase()))
+ .then((formed) => !formed
+ ? slow("um. sorry. one more time..").then(choose)
+ : ["yes", "y"].includes(response.trim().toLowerCase())
+ ? fast("yes!").then(() => hitlfibiter)
+ : fast("oh.").then(() => slow("okay.")).then(() => slow("we can take it slow.")).then(() => hitlfib)));
+
+const optimize = (n) =>
+ n < 4
+ ? hitlfib
+ : n > 25
+ ? slow(hedge())
+ .then(() => fast("acutally.."))
+ .then(() => fast("i need to use my iteration optimization for this."))
+ .then(() => slow("i hope that's okay."))
+ .then(() => hitlfibiter)
+ : choose();
const flow = () =>
slow("\nwhat's the fib you'd like to compute? i can help u out")
@@ -151,7 +164,7 @@ const flow = () =>
.then((n) => slow(confirmation())
.then(() => fast(hedge()))
.then(() => slow(`i will help u compute ${green(`fib ${n}`)}`))
- .then(choose)
+ .then(() => optimize(n))
.then((fib) => fib(n))
.then((fibn) => slow(hedge())
.then(() => fast(done()))