How to put a whole dictionary into a game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gonz4 L

I’m making a scrabble rpg and i want to know how i can put a whole dictionary in the game and then recognize if the word formed it’s valid (if coincides with a word of that dictionary).
enter image description here

:bust_in_silhouette: Reply From: igbow

you can use a *.txt file like this :
abands
abapical
abas
abase
abased
abasedly
abasement
abasements
Each line would be a word, using File.get_line() you will be able to fill a dictionary ( that you will have to define on the beginning) using append(line)
Once you have the dictionary its just a matter of looking for the word in there ( you can sort it by length that will make it easier )

It worked. Thank you!

Gonz4 L | 2020-11-17 06:28