diff --git a/src/lib/Board.svelte b/src/lib/Board.svelte index a9e8fe9..3e942d0 100644 --- a/src/lib/Board.svelte +++ b/src/lib/Board.svelte @@ -12,6 +12,7 @@ let selectedJ: number | undefined = undefined; let status: 'incomplete' | 'error' | 'won' = 'incomplete'; let valueMode: 'Write' | 'Annotation' = 'Write'; + let lastMode: Difficulty; const onSelect = (i: number, j: number) => () => { if (i === selectedI && j === selectedJ) { @@ -47,7 +48,7 @@ } }; - const onGameCommand = (mode: string) => { + const onGameCommand = (mode: 'reset' | Difficulty) => { if (mode === 'reset') { board.reset(); board.grid = board.grid; // to trigger reload @@ -56,20 +57,21 @@ if (mode === 'easy') board.prepare(Difficulty.Easy); else if (mode === 'medium') board.prepare(Difficulty.Medium); else if (mode === 'hard') board.prepare(Difficulty.Hard); + lastMode = mode; } }; let board: Board; let jsConfetti: JSConfetti; - onGameCommand('easy'); + onGameCommand(Difficulty.Medium); onMount(() => { jsConfetti = new JSConfetti(); }); - +

STATUS: {status}

diff --git a/src/lib/GameCommands.svelte b/src/lib/GameCommands.svelte index 60181ad..6f12635 100644 --- a/src/lib/GameCommands.svelte +++ b/src/lib/GameCommands.svelte @@ -1,22 +1,13 @@
- - - - + {#each ['reset', 'easy', 'medium', 'hard'] as mode (mode)} + + {/each}
diff --git a/src/lib/Switch.svelte b/src/lib/Switch.svelte index c5da96d..94b20f7 100644 --- a/src/lib/Switch.svelte +++ b/src/lib/Switch.svelte @@ -75,7 +75,7 @@ @reference "tailwindcss"; :root { - --accent-color: theme(colors.emerald.400); + --accent-color: theme(colors.emerald.300); --gray: #ccc; } /* Inner Design Option */ diff --git a/src/lib/core/board.ts b/src/lib/core/board.ts index 710f66a..af65a47 100644 --- a/src/lib/core/board.ts +++ b/src/lib/core/board.ts @@ -1,9 +1,9 @@ export enum Difficulty { - Easy, - Medium, - Hard, - Last, - Done + Easy = 'easy', + Medium = 'medium', + Hard = 'hard', + Last = 'last', + Done = 'done' } export type Case = number | undefined; @@ -17,11 +17,11 @@ function shuffleArray(array: Array): void { function getNumberToKeepFromDifficulty(difficulty: Difficulty) { const rules = { - 0: 3, - 1: 2, - 2: 1, - 3: 8, - 4: 9 + easy: 3, + medium: 2, + hard: 1, + last: 8, + done: 9 }; return rules[difficulty]; } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 1fbd321..fe60a99 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -2,6 +2,10 @@ import Board from '$lib/Board.svelte'; + + FUBIKI + +

Fubuki