# Help with word unscramble bot

#42

@Mr.rex

it randomly swaps the letters until it finds a word or fails to find one

That’s the right general idea, but the difficulty is how it “finds a word” or not. I couldn’t sort out how to make your project work, but I made one to show how it can be done.

I used the encoding described above to calculate a unique value for each word (and combination of letters) and Heap’s algorithm (linked above) to test all the letter combinations. A dictionary (set of clones) holds all of the values that the project knows to be words.

Using these ideas the project does 3 to 9 letter words with no code changes.

To add more words, just increase the number of dictionary clones & add another Set Dictionary Value block with the value of the new word. That value can be found by manually (swiping) setting the letters to the word & checking the greyed number in the bottom left.

#43

@Mr.rex

After creating my version I was able to go back and fix yours:

https://c.gethopscotch.com/p/z05op01nv

I changed the logic so that:

1st letter: randomized to any of the 3 options

• 1, 2, or 3

2nd letter: randomized to either of the 2 remaining options

• adds random (1 or 2) to 1st letter. 1 or 4 = 1 (can’t = 1), 2 or 5 = 2, else 3

3rd letter: set to letter not yet selected

• if 1st & 2nd are value 2 & 3, sum (either order) is 5, therefore = 1
• if 1st & 2nd are value 1 & 3, sum (either order) is 4, therefore = 2
• else 3

Let me know if you’ve any questions

#44

One question is why did you remix my fusion generator

#45

When I remixed your Unscramble Bot, the remix symbol wasn’t in the corner. I think maybe because you unpublished the project? Anyways, I was just trying to remix a different project so I could see the json data & try to add the remix symbol back to the remixed Unscramble Bot…

#46

So you remixed my fusion generator

#47

Yes (but immediately unpublished it), so I could see exactly what json data was added that tells the Hopscotch app to put the remix symbol in the corner.