Linus 2022-02-20 10:53:47 +00:00 zatwierdzone przez GitHub
commit 4126e5d95a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 21 dodań i 4 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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)}
/>
<div>
<label htmlFor="difficulty-setting">Difficulty:</label>
<strong>{["Normal", "Hard", "Ultra Hard"][difficulty]}</strong>
<strong>{["Normal", "Hard", "Ultra Hard", "IMPOSSIBLE"][difficulty]}</strong>
<div
style={{
fontSize: 14,
@ -146,6 +147,7 @@ function App() {
`Guesses must be valid dictionary words.`,
`Wordle's "Hard Mode". Green letters must stay fixed, and yellow letters must be reused.`,
`An even stricter Hard Mode. Yellow letters must move away from where they were clued, and gray clues must be obeyed.`,
`By far the hardest mode. You are only given a full row of red if you guess incorrectly, with absolutely no feedback. There's a reason it's called Impossible.`
][difficulty]
}
</div>

Wyświetl plik

@ -337,8 +337,8 @@ function Game(props: GameProps) {
<button
onClick={() => {
const emoji = props.colorBlind
? ["⬛", "🟦", "🟧"]
: ["⬛", "🟨", "🟩"];
? ["⬛", "🟦", "🟧", "🟧"]
: ["⬛", "🟨", "🟩", "🟧"];
share(
"Result copied to clipboard!",
guesses

Wyświetl plik

@ -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 && word !== target) { // Make sure the guess doesn't match the target word before filling with red
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[],

Wyświetl plik

@ -4,6 +4,7 @@ export enum Difficulty {
Normal,
Hard,
UltraHard,
Impossible,
}
export const maxGuesses = 6;