Daily Industrial Wordl

This commit is contained in:
wordsmith
2022-02-07 18:50:13 -05:00
parent 135c0a8d0d
commit 8a1af6f9fa
6 changed files with 13 additions and 29 deletions

1
.tool-versions Normal file
View File

@@ -0,0 +1 @@
nodejs 16.13.1

1
CNAME
View File

@@ -1 +0,0 @@
hellowordl.net

View File

@@ -140,7 +140,7 @@ table.Game-rows > tbody {
}
body.dark {
background-color: #404040;
background-color: #121213;
color: #e0e0e0;
color-scheme: dark;
}

View File

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

View File

@@ -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={() => {

View File

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