Mert
Member
Hi. I have a ds_list that contains 680.000 words. I alphabetically listed them (from A > Z)
I also have a list that contains the words used before. Whenever I get a word from the main list, I add this word's position to my second list so that I know that this word was used before.
What I want to do is;
I'm worried about the performance because I'll be serving the game on Mobile & Web platforms. I wonder if you have better solutions for this ?
I also have a list that contains the words used before. Whenever I get a word from the main list, I add this word's position to my second list so that I know that this word was used before.
What I want to do is;
- Get a word that starts with the letter "B".
- Check if I used this word before.
- Confirm that the word can be used, otherwise get back to the loop where I left off.
Code:
//wordList & usedWords are ds_lists
var list_length = ds_list_size(wordList);
for (var i = 0; i < list_length; ++i) {
var l = wordList[| i];
if (ds_list_find_index(usedWords,i)==-1) //This word was never used before.
{
if (string_char_at(l,1)=="B") //Check if it starts with B
{
///Use the Word.
///Do the Operation
ds_list_add(usedWords,i);
return l;
}
}
}