From 2c11ce9efac984fbd47c5e938874f7f98a89e306 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sun, 13 Feb 2022 22:48:19 -0800 Subject: [PATCH] Parse guesses instead of hardcoding them --- web/pages/wordle/index.tsx | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/web/pages/wordle/index.tsx b/web/pages/wordle/index.tsx index b80438fd..6e25e712 100644 --- a/web/pages/wordle/index.tsx +++ b/web/pages/wordle/index.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react' import { Page } from '../../components/page' import { Title } from '../../components/title' // From https://github.com/lynn/hello-wordl @@ -11,15 +12,10 @@ export default function Wordle() { // const dict = dictionary.filter((word) => word.length === WORD_LENGTH) const words = targets.filter((word) => word.length === WORD_LENGTH) - const pastGuesses: PastGuess[] = [ - // From https://hellowordl.net/?challenge=aGFyZHk - // { guess: 'sheep', result: 'BYBBB' }, - // { guess: 'butch', result: 'BBBBY' }, - // { guess: 'hydra', result: 'GYYYY' }, - // Answer: hardy - { guess: 'snowy', result: 'BBBYB' }, - { guess: 'wheel', result: 'GYBBB' }, - ] + const [input, setInput] = useState('') + + const pastGuesses: PastGuess[] = parsePastGuesses(input) + const placeholder = 'e.g.\nstage BBYBB\nlucre YYGYY' const valids = validHardMode(words, pastGuesses) @@ -34,7 +30,12 @@ export default function Wordle() { Actually for{' '} https://hellowordl.net/

Past guesses:

-
{JSON.stringify(pastGuesses, null, 2)}
+