diff --git a/src/App.css b/src/App.css
index ef91d90..89fe02b 100644
--- a/src/App.css
+++ b/src/App.css
@@ -163,4 +163,10 @@ a:active {
.App-about {
margin-top: -1rem;
line-height: 1.4;
-}
\ No newline at end of file
+}
+
+.Game-seed-info {
+ opacity: 0.5;
+ margin-top: 1em;
+ font-variant-numeric: tabular-nums;
+}
diff --git a/src/App.tsx b/src/App.tsx
index 0991b45..75bce03 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,6 +1,6 @@
import "./App.css";
import common from "./common.json";
-import { dictionarySet, pick } from "./util";
+import { dictionarySet, pick, seed } from "./util";
import Game from "./Game";
import { names } from "./names";
import { useState } from "react";
@@ -18,6 +18,19 @@ function App() {
{about ? "Close" : "About"}
+
{about && (
@@ -49,8 +62,7 @@ function App() {
R is correct! The third letter is R
.
- D occurs elsewhere in the target
- word.
+ D occurs elsewhere in the target word.
Let's move the D in our next guess:
@@ -77,7 +89,9 @@ function App() {
/>
Got it!
- Report issues
here, or tweet
@chordbug.
+ Report issues{" "}
+
here, or
+ tweet
@chordbug.
)}
diff --git a/src/Game.tsx b/src/Game.tsx
index b7b319e..14cda38 100644
--- a/src/Game.tsx
+++ b/src/Game.tsx
@@ -4,7 +4,7 @@ import dictionary from "./dictionary.json";
import { Clue, clue } from "./clue";
import { Keyboard } from "./Keyboard";
import common from "./common.json";
-import { dictionarySet, pick, resetRng } from "./util";
+import { dictionarySet, pick, resetRng, seed } from "./util";
import { names } from "./names";
enum GameState {
@@ -33,20 +33,25 @@ function Game(props: GameProps) {
const [currentGuess, setCurrentGuess] = useState("");
const [wordLength, setWordLength] = useState(5);
const [hint, setHint] = useState(`Make your first guess!`);
- const [target, setTarget] = useState(() => randomTarget(wordLength));
+ const [target, setTarget] = useState(() => {
+ resetRng();
+ return randomTarget(wordLength);
+ });
+ const [gameNumber, setGameNumber] = useState(1);
- const reset = () => {
+ const startNextGame = () => {
setTarget(randomTarget(wordLength));
setGuesses([]);
setCurrentGuess("");
setHint("");
setGameState(GameState.Playing);
+ setGameNumber((x) => x + 1);
};
const onKey = (key: string) => {
if (gameState !== GameState.Playing) {
if (key === "Enter") {
- reset();
+ startNextGame();
}
return;
}
@@ -137,6 +142,8 @@ function Game(props: GameProps) {
onChange={(e) => {
const length = Number(e.target.value);
resetRng();
+ setGameNumber(1);
+ setGameState(GameState.Playing);
setGuesses([]);
setTarget(randomTarget(length));
setWordLength(length);
@@ -161,6 +168,11 @@ function Game(props: GameProps) {
{rowDivs}
{hint || `\u00a0`}
+ {seed ? (
+
+ seed {seed}, length {wordLength}, game {gameNumber}
+
+ ) : undefined}
);
}
diff --git a/src/common.json b/src/common.json
index 5c0eea8..d042005 100644
--- a/src/common.json
+++ b/src/common.json
@@ -13288,7 +13288,6 @@
"messengers",
"buckingham",
"werden",
- "danny",
"lyrics",
"priced",
"banned",
@@ -13297,7 +13296,6 @@
"hurricane",
"ecstasy",
"bait",
- "carr",
"sunrise",
"infringement",
"hermann",
diff --git a/src/util.ts b/src/util.ts
index f593af9..eab07fe 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -11,7 +11,9 @@ function mulberry32(a: number) {
};
}
-const seed = Number(new URLSearchParams(window.location.search).get("seed"));
+export const seed = Number(
+ new URLSearchParams(window.location.search).get("seed")
+);
const makeRandom = () => (seed ? mulberry32(seed) : () => Math.random());
let random = makeRandom();