Download

Comparing Text variables letter by letter

I am currently working on a word game. What i need to do is take what the player input into the text box and compare it with a hidden word letter by letter. ie:
Hidden word: planet
player guess: ptayer
what and how would i use to go through and figure out if the letters were the same and in the correct spot? ie:
p and p line up and are correct, which equals a Bull
t is use in the hidden word but not in the correct place, which equals a Cow
y is not used all in the hidden word, it gets ignored after checking the hidden word for it

https://drive.google.com/open?id=0By8ISCXMLTC4WkxsVXhWTi04aW8 ← this is my current code
https://drive.google.com/open?id=0By8ISCXMLTC4dE54ajFNLWJobkk <— this is the running game so far

Edit: ive added a button to initiate the word checking

Assuming you don’t want one letter in the hidden word to trigger 2 times cow or bull:

6d91695d4c7e7a8476fb7c0e494095ed2622f518.png

e4554df562ac27b257cce42e81a6fb6b54b0f0ab.png

Thanks! It works great! I understand the blueprint mostly, im just curious what is the last index and remove index doing?

LastIndex returns the index of the last element in the array. It’s basically the same as using a length node and subtracting it with 1. The ForLoopReverse is just used to iterate over each element of the array and comparing each element one by one of the 2 arrays. Please note that this function will only work correctly when the Input and the Dictionary String have the same length. If you don’t make sure that they have the same length you better change the following: Instead of plugging in LastIndex of LocalInput plug in the minimum of the LastIndex of LocalInput and the LastIndex of LocalDict in the FirstIndex of the ForLoopReverse.

RemoveIndex removes the array element at a given Index. You want to remove those to make sure you don’t test them when you try to determine how many cows are there. Please note that removing elements within the loop is the reason why a ForLoopReverse is necessary.