Daily Industrial Wordl
This commit is contained in:
1
.tool-versions
Normal file
1
.tool-versions
Normal file
@@ -0,0 +1 @@
|
||||
nodejs 16.13.1
|
||||
@@ -140,7 +140,7 @@ table.Game-rows > tbody {
|
||||
}
|
||||
|
||||
body.dark {
|
||||
background-color: #404040;
|
||||
background-color: #121213;
|
||||
color: #e0e0e0;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
@@ -74,16 +74,14 @@ function App() {
|
||||
fontStyle: difficulty > 1 ? "italic" : "inherit",
|
||||
}}
|
||||
>
|
||||
hell
|
||||
Industrial Wordl
|
||||
</span>
|
||||
o wordl
|
||||
</h1>
|
||||
<div className="top-right">
|
||||
{page !== "game" ? (
|
||||
link("❌", "Close", "game")
|
||||
) : (
|
||||
<>
|
||||
{link("❓", "About", "about")}
|
||||
{link("⚙️", "Settings", "settings")}
|
||||
</>
|
||||
)}
|
||||
@@ -96,11 +94,7 @@ function App() {
|
||||
visibility: page === "game" ? "visible" : "hidden",
|
||||
}}
|
||||
>
|
||||
<a href={seed ? "?random" : "?seed=" + todaySeed}>
|
||||
{seed ? "Random" : "Today's"}
|
||||
</a>
|
||||
</div>
|
||||
{page === "about" && <About />}
|
||||
{page === "settings" && (
|
||||
<div className="Settings">
|
||||
<div className="Settings-setting">
|
||||
|
||||
22
src/Game.tsx
22
src/Game.tsx
@@ -157,7 +157,7 @@ function Game(props: GameProps) {
|
||||
const onKey = (key: string) => {
|
||||
if (gameState !== GameState.Playing) {
|
||||
if (key === "Enter") {
|
||||
startNextGame();
|
||||
// startNextGame();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -192,9 +192,7 @@ function Game(props: GameProps) {
|
||||
setCurrentGuess((guess) => "");
|
||||
|
||||
const gameOver = (verbed: string) =>
|
||||
`You ${verbed}! The answer was ${target.toUpperCase()}. (Enter to ${
|
||||
challenge ? "play a random game" : "play again"
|
||||
})`;
|
||||
`You ${verbed}! The answer was ${target.toUpperCase()}.`;
|
||||
|
||||
if (currentGuess === target) {
|
||||
setHint(gameOver("won"));
|
||||
@@ -287,7 +285,7 @@ function Game(props: GameProps) {
|
||||
disabled={gameState !== GameState.Playing || guesses.length === 0}
|
||||
onClick={() => {
|
||||
setHint(
|
||||
`The answer was ${target.toUpperCase()}. (Enter to play again)`
|
||||
`The answer was ${target.toUpperCase()}.`
|
||||
);
|
||||
setGameState(GameState.Lost);
|
||||
(document.activeElement as HTMLElement)?.blur();
|
||||
@@ -318,21 +316,7 @@ function Game(props: GameProps) {
|
||||
letterInfo={letterInfo}
|
||||
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>
|
||||
<button
|
||||
onClick={() => {
|
||||
share("Link copied to clipboard!");
|
||||
}}
|
||||
>
|
||||
Share a link to this game
|
||||
</button>{" "}
|
||||
{gameState !== GameState.Playing && (
|
||||
<button
|
||||
onClick={() => {
|
||||
|
||||
@@ -32,7 +32,13 @@ export function resetRng(): void {
|
||||
}
|
||||
|
||||
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/
|
||||
|
||||
Reference in New Issue
Block a user