Basically, I am trying to create my own game of wordle in scratch but I got stuck on where I need to make a list of possible words, so they cannot just type in all random letters, so all words they have to type in have to be real words. So, I pulled up someone else code but I cannot find where they made their list of possible words to be able to input. The code I am trying to find the word list is https://scratch.mit.edu/projects/624796156/ and click see inside to view their code. It would be really helpful if someone were to reply and tell me where they added a wordlist in their code. Thanks!
CodePudding user response:
This scratch project has a list variable named "Valid Words". In the orange "Variables" section of the blocks menu, you'll see light orange scalar variables and light orange blocks which operate on scalar variables, followed by dark orange list variables and dark orange blocks which operate on list variables. Check the box next to a variable to make it appear on the editor's graphical display, making it easier to view or edit the variable's initial value(s).
CodePudding user response:
It is possible to pre-fill a list. This content becomes part of the project, and will be instantly available to anyone visiting the project.
First of all, find the list block in the list of available blocks (the panel to the left of the code area). Turn on the checkbox in front of the list block. This will make the list visible on the stage. (Once we are done, you can turn this off again.)
Now there are two ways to populate the list.
- Manually. Click the
- Import. Right-click the list. From the context menu, select import. From the file dialog, select a text file you prepared with a list of words; each word on a separate line.
Given the number of 5-letter words (10,658 in the project you linked to), I'd recommend approach #2.
Tip: you could export the list of words from the project you linked to, and import that list into your own project. Please do not forget to give credit.