From e25ae72029ea8d2cb48f435dda4b05ede1c4a3ad Mon Sep 17 00:00:00 2001 From: Adam Shamblin Date: Tue, 14 Jun 2022 18:50:53 -0600 Subject: [PATCH] Minor reorg of files, making progress on wordle --- gpio.fs => src/gpio.fs | 0 qol.fs => src/qol.fs | 0 rtc.fs => src/rtc.fs | 0 sysinfo.fs => src/sysinfo.fs | 0 terminal.fs => src/terminal.fs | 0 timer.fs => src/timer.fs | 0 wordle.fs => src/wordle.fs | 30 ++++++++++++++++++- .../words-no-spaces.txt | 0 words-short.txt => test/words-short.txt | 0 words.txt => test/words.txt | 0 10 files changed, 29 insertions(+), 1 deletion(-) rename gpio.fs => src/gpio.fs (100%) rename qol.fs => src/qol.fs (100%) rename rtc.fs => src/rtc.fs (100%) rename sysinfo.fs => src/sysinfo.fs (100%) rename terminal.fs => src/terminal.fs (100%) rename timer.fs => src/timer.fs (100%) rename wordle.fs => src/wordle.fs (50%) rename words-no-spaces.txt => test/words-no-spaces.txt (100%) rename words-short.txt => test/words-short.txt (100%) rename words.txt => test/words.txt (100%) diff --git a/gpio.fs b/src/gpio.fs similarity index 100% rename from gpio.fs rename to src/gpio.fs diff --git a/qol.fs b/src/qol.fs similarity index 100% rename from qol.fs rename to src/qol.fs diff --git a/rtc.fs b/src/rtc.fs similarity index 100% rename from rtc.fs rename to src/rtc.fs diff --git a/sysinfo.fs b/src/sysinfo.fs similarity index 100% rename from sysinfo.fs rename to src/sysinfo.fs diff --git a/terminal.fs b/src/terminal.fs similarity index 100% rename from terminal.fs rename to src/terminal.fs diff --git a/timer.fs b/src/timer.fs similarity index 100% rename from timer.fs rename to src/timer.fs diff --git a/wordle.fs b/src/wordle.fs similarity index 50% rename from wordle.fs rename to src/wordle.fs index 9520f60..f09c41a 100644 --- a/wordle.fs +++ b/src/wordle.fs @@ -31,4 +31,32 @@ lexicon VARIABLE lex-ptr WORDSIZE lex-ptr +! REPEAT ; -: wordle ( -- ) ; +: advance ( -- ) WORDSIZE lex-ptr +! ; + +: store ( size addr -- ) lex-ptr @ SWAP MOVE advance ; + +: fake-lexicon ( addr -- ) + s" women" store + s" nikau" store + s" swack" store + s" feens" store ; + +: word. ( index -- ) WORDSIZE * lexicon + WORDSIZE TYPE ; +: word@ ( index -- addr ) WORDSIZE * lexicon + ; +: randword. ( -- addr ) 2 random word. ; +: randword@ ( -- addr ) 2 random word@ ; + +: check-word ( input target -- ) + WORDSIZE 0 DO + I + C@ <# # #> type + LOOP ; + +0 VARIABLE target + +: wordle ( -- ) + randword@ target ! \ Get random word + 6 0 DO + \ Accept user input + \ Show matching letters + LOOP + ; diff --git a/words-no-spaces.txt b/test/words-no-spaces.txt similarity index 100% rename from words-no-spaces.txt rename to test/words-no-spaces.txt diff --git a/words-short.txt b/test/words-short.txt similarity index 100% rename from words-short.txt rename to test/words-short.txt diff --git a/words.txt b/test/words.txt similarity index 100% rename from words.txt rename to test/words.txt -- 2.39.5