From f9913ac0828bd1410dbabec22bda2c40d06fed90 Mon Sep 17 00:00:00 2001 From: Linus <46013061+Cortex128@users.noreply.github.com> Date: Sun, 20 Feb 2022 05:08:55 -0500 Subject: [PATCH 1/6] add impossible difficulty to list --- src/util.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util.ts b/src/util.ts index cb02446b9..d6a7c7fa6 100644 --- a/src/util.ts +++ b/src/util.ts @@ -4,6 +4,7 @@ export enum Difficulty { Normal, Hard, UltraHard, + Impossible, } export const maxGuesses = 6; From 1289985b90bc73bf1f37435d92d1194f99ee0aa7 Mon Sep 17 00:00:00 2001 From: Linus <46013061+Cortex128@users.noreply.github.com> Date: Sun, 20 Feb 2022 05:19:23 -0500 Subject: [PATCH 2/6] Return red if on impossible difficulty --- src/clue.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/clue.ts b/src/clue.ts index aeed2e1a0..f8ab4c466 100644 --- a/src/clue.ts +++ b/src/clue.ts @@ -1,9 +1,11 @@ import { Difficulty, englishNumbers, ordinal } from "./util"; +const impossible = difficulty === Difficulty.Impossible; export enum Clue { Absent, Elsewhere, Correct, + Red, } export interface CluedLetter { @@ -20,6 +22,9 @@ export function clue(word: string, target: string): CluedLetter[] { }); return word.split("").map((letter, i) => { let j: number; + if (impossible) { + return { clue: Clue.Red, letter }; + } if (target[i] === letter) { return { clue: Clue.Correct, letter }; } else if ((j = elusive.indexOf(letter)) > -1) { @@ -37,6 +42,8 @@ export function clueClass(clue: Clue): string { return "letter-absent"; } else if (clue === Clue.Elsewhere) { return "letter-elsewhere"; + } else if (clue === Clue.Red) { + return "letter-red"; } else { return "letter-correct"; } @@ -58,6 +65,7 @@ export function describeClue(clue: CluedLetter[]): string { .join(", "); } +// Impossible difficulty has no need for restricting usable guesses export function violation( difficulty: Difficulty, clues: CluedLetter[], From 17c0df4b470b066ef74d4106fdbf0b8d5d5be185 Mon Sep 17 00:00:00 2001 From: Linus <46013061+Cortex128@users.noreply.github.com> Date: Sun, 20 Feb 2022 05:22:35 -0500 Subject: [PATCH 3/6] Css class for red letters in impossible difficulty --- src/App.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/App.css b/src/App.css index 676f39461..d4055e864 100644 --- a/src/App.css +++ b/src/App.css @@ -139,6 +139,12 @@ table.Game-rows > tbody { color: white !important; } +.letter-red { + border: 2px solid rgba(0, 0, 0, 0.3); + background-color: #ff0000; + color: white !important; +} + body.dark { background-color: #404040; color: #e0e0e0; From 4872caa519dc7c6cb6b29d049edc9364351e5c66 Mon Sep 17 00:00:00 2001 From: Linus <46013061+Cortex128@users.noreply.github.com> Date: Sun, 20 Feb 2022 05:29:44 -0500 Subject: [PATCH 4/6] Add Impossible to slider with description --- src/App.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c40a20687..3d81f282c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -72,6 +72,7 @@ function App() { style={{ color: difficulty > 0 ? "#e66" : "inherit", fontStyle: difficulty > 1 ? "italic" : "inherit", + fontStyle: difficulty > 2 ? "bold" : "inherit", // I have no idea what this syntax means. I'm just mimicing and hoping for the best }} > hell @@ -126,13 +127,13 @@ function App() { id="difficulty-setting" type="range" min="0" - max="2" + max="3" value={difficulty} onChange={(e) => setDifficulty(+e.target.value)} />