Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ table.Game-rows > tbody {
justify-content: stretch;
}

.Game-keyboard-button {
.Game-keyboard-button,
.Game-random-guess {
margin: 2px;
background-color: #cdcdcd;
padding: 2px;
Expand Down
2 changes: 2 additions & 0 deletions src/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Row, RowState } from "./Row";
import dictionary from "./dictionary.json";
import { Clue, clue, describeClue, violation } from "./clue";
import { Keyboard } from "./Keyboard";
import { RandomGuess } from "./RandomGuess";
import targetList from "./targets.json";
import {
dictionarySet,
Expand Down Expand Up @@ -287,6 +288,7 @@ function Game(props: GameProps) {
letterInfo={letterInfo}
onKey={onKey}
/>
<RandomGuess onKey={onKey} wordLength={wordLength} />
{gameState !== GameState.Playing && (
<p>
<button
Expand Down
28 changes: 28 additions & 0 deletions src/RandomGuess.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
interface GuessProps {
onKey: (key: string) => void;
wordLength: number;
}

export function RandomGuess(props: GuessProps) {
return (
<div className="Game-random" aria-hidden="true">
<div className="Game-random-guess"
tabIndex={-1}
role="button"
onClick={() => {
let guess = "";
Comment thread
Oreolek marked this conversation as resolved.
Outdated
for (let i = 0; i < props.wordLength; i++) {
props.onKey("Backspace")
}
const chars = "abcdefghijklmnopqrstuvwxyz";
for (let i = 0; i < props.wordLength; i++) {
let letter = chars.charAt(Math.random() * chars.length)
Comment thread
Oreolek marked this conversation as resolved.
Outdated
props.onKey(letter);
}
}}
>
Random Guess
</div>
</div>
);
}