Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d99447776e | ||
|
|
8a1af6f9fa |
1
.tool-versions
Normal file
1
.tool-versions
Normal file
@@ -0,0 +1 @@
|
|||||||
|
nodejs 16.13.1
|
||||||
27912
package-lock.json
generated
27912
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -140,7 +140,7 @@ table.Game-rows > tbody {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body.dark {
|
body.dark {
|
||||||
background-color: #404040;
|
background-color: #121213;
|
||||||
color: #e0e0e0;
|
color: #e0e0e0;
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,16 +74,14 @@ function App() {
|
|||||||
fontStyle: difficulty > 1 ? "italic" : "inherit",
|
fontStyle: difficulty > 1 ? "italic" : "inherit",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
hell
|
Industrial Wordl
|
||||||
</span>
|
</span>
|
||||||
o wordl
|
|
||||||
</h1>
|
</h1>
|
||||||
<div className="top-right">
|
<div className="top-right">
|
||||||
{page !== "game" ? (
|
{page !== "game" ? (
|
||||||
link("❌", "Close", "game")
|
link("❌", "Close", "game")
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{link("❓", "About", "about")}
|
|
||||||
{link("⚙️", "Settings", "settings")}
|
{link("⚙️", "Settings", "settings")}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -96,11 +94,7 @@ function App() {
|
|||||||
visibility: page === "game" ? "visible" : "hidden",
|
visibility: page === "game" ? "visible" : "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a href={seed ? "?random" : "?seed=" + todaySeed}>
|
|
||||||
{seed ? "Random" : "Today's"}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
{page === "about" && <About />}
|
|
||||||
{page === "settings" && (
|
{page === "settings" && (
|
||||||
<div className="Settings">
|
<div className="Settings">
|
||||||
<div className="Settings-setting">
|
<div className="Settings-setting">
|
||||||
|
|||||||
22
src/Game.tsx
22
src/Game.tsx
@@ -157,7 +157,7 @@ function Game(props: GameProps) {
|
|||||||
const onKey = (key: string) => {
|
const onKey = (key: string) => {
|
||||||
if (gameState !== GameState.Playing) {
|
if (gameState !== GameState.Playing) {
|
||||||
if (key === "Enter") {
|
if (key === "Enter") {
|
||||||
startNextGame();
|
// startNextGame();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -192,9 +192,7 @@ function Game(props: GameProps) {
|
|||||||
setCurrentGuess((guess) => "");
|
setCurrentGuess((guess) => "");
|
||||||
|
|
||||||
const gameOver = (verbed: string) =>
|
const gameOver = (verbed: string) =>
|
||||||
`You ${verbed}! The answer was ${target.toUpperCase()}. (Enter to ${
|
`You ${verbed}! The answer was ${target.toUpperCase()}.`;
|
||||||
challenge ? "play a random game" : "play again"
|
|
||||||
})`;
|
|
||||||
|
|
||||||
if (currentGuess === target) {
|
if (currentGuess === target) {
|
||||||
setHint(gameOver("won"));
|
setHint(gameOver("won"));
|
||||||
@@ -287,7 +285,7 @@ function Game(props: GameProps) {
|
|||||||
disabled={gameState !== GameState.Playing || guesses.length === 0}
|
disabled={gameState !== GameState.Playing || guesses.length === 0}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setHint(
|
setHint(
|
||||||
`The answer was ${target.toUpperCase()}. (Enter to play again)`
|
`The answer was ${target.toUpperCase()}.`
|
||||||
);
|
);
|
||||||
setGameState(GameState.Lost);
|
setGameState(GameState.Lost);
|
||||||
(document.activeElement as HTMLElement)?.blur();
|
(document.activeElement as HTMLElement)?.blur();
|
||||||
@@ -318,21 +316,7 @@ function Game(props: GameProps) {
|
|||||||
letterInfo={letterInfo}
|
letterInfo={letterInfo}
|
||||||
onKey={onKey}
|
onKey={onKey}
|
||||||
/>
|
/>
|
||||||
<div className="Game-seed-info">
|
|
||||||
{challenge
|
|
||||||
? "playing a challenge game"
|
|
||||||
: seed
|
|
||||||
? `${describeSeed(seed)} — length ${wordLength}, game ${gameNumber}`
|
|
||||||
: "playing a random game"}
|
|
||||||
</div>
|
|
||||||
<p>
|
<p>
|
||||||
<button
|
|
||||||
onClick={() => {
|
|
||||||
share("Link copied to clipboard!");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Share a link to this game
|
|
||||||
</button>{" "}
|
|
||||||
{gameState !== GameState.Playing && (
|
{gameState !== GameState.Playing && (
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -32,7 +32,13 @@ export function resetRng(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function pick<T>(array: Array<T>): T {
|
export function pick<T>(array: Array<T>): T {
|
||||||
return array[Math.floor(array.length * random())];
|
const todaySeed = Number(new Date().toISOString().replace(/-/g, "").slice(0, 8));
|
||||||
|
console.log(todaySeed);
|
||||||
|
let val = mulberry32(todaySeed)();
|
||||||
|
let index = val;
|
||||||
|
const floored = Math.floor(array.length * index);
|
||||||
|
const word = array[floored];
|
||||||
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://a11y-guidelines.orange.com/en/web/components-examples/make-a-screen-reader-talk/
|
// https://a11y-guidelines.orange.com/en/web/components-examples/make-a-screen-reader-talk/
|
||||||
|
|||||||
Reference in New Issue
Block a user