From 433369de6fe020b668a59e4f9baa76b80be5bcc7 Mon Sep 17 00:00:00 2001 From: zevav Date: Mon, 15 Jun 2020 01:21:00 +0200 Subject: [PATCH] title, appearance, a few more bugs, better defaults --- public/index.html | 2 +- src/components/Inputs.svelte | 3 +++ src/components/Problem.svelte | 11 +++++++++-- src/config.js | 4 ++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index 5da7ed3..4c140ad 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - Svelte app + Binary Quiz! diff --git a/src/components/Inputs.svelte b/src/components/Inputs.svelte index ddfbc2e..c6573b3 100644 --- a/src/components/Inputs.svelte +++ b/src/components/Inputs.svelte @@ -17,6 +17,9 @@ if (!$num_problems){ num_problems.update(() => DEFAULT_NUM_PROBLEMS) } + if (!$bits){ + bits.update(() => DEFAULT_BITS) + } const problems_ = generateProblems($bits, $num_problems) problems.update(() => problems_) activeQuiz.update(() => true) diff --git a/src/components/Problem.svelte b/src/components/Problem.svelte index 3e5ed19..1601da8 100644 --- a/src/components/Problem.svelte +++ b/src/components/Problem.svelte @@ -34,8 +34,15 @@ {#if displaySummary} -
Congratulations, you've completed {$num_problems} {$bits}-bit problems!
- Go back to home screen. +
+
+ Congratulations, you've completed {$num_problems} {$bits}-bit problems! +
+
+ Go back to the home screen. +
+
+ {:else}
diff --git a/src/config.js b/src/config.js index 5fd44dc..cd2bbcc 100644 --- a/src/config.js +++ b/src/config.js @@ -4,8 +4,8 @@ export const MIN_PROBLEMS = 2 export const MAX_PROBLEMS = 99 export const MAX_DIGITS_PROBLEMS = MAX_PROBLEMS.toString().length export const MAX_DIGITS_BITS = MAX_BITS.toString().length -export const DEFAULT_BITS = 8 -export const DEFAULT_NUM_PROBLEMS = 20 +export const DEFAULT_BITS = 4 +export const DEFAULT_NUM_PROBLEMS = 10 export const getMaxPermutations = (bits) => { return Math.pow(2, bits)