I'm going to update our word ouray.
So it's a lot simpler for me and I can really easily do the solution because coming in now, we want
to have a quick and easy way to test out the solutions.
So I brought that down to contain strings of A, B, B or C, C, so now we have a simpler array to
work with of letters.
Let's apply some of our logic, creating another value to guess, we'll call it guess, and this is
going to count how many of the letters the player got.
So when they come in, it starts out at zero as we loop through the solution.
So as we look through all of these available characters, we can see that if this increases, then that
means that the player gets a certain number of them correctly.
So after we complete our loop, we can check to see if the value of guess is greater than zero.
And if it is that we know that the guest multiple values.
Correct.
So your solution is C..
So we can say you found two letters.
We can also calculate out how many letters are left.
This is no list.
So it does have a length.
If we subtract the value of guess plus counter, that's going to give us a value of how many letters
are left.
And we can log that out to the console as well to see that you found two letters and there's zero letters
left is less than one.
That means that they've solved the puzzle.
And we want to show the start button again, updating the style display to equal block.
So that's going to show up again.
And so we get our start button again and we can start the game again.
Notice that what happened here is we didn't get rid of what we currently had in place.
We have to clean up some of the content.
So we've got output one and the inner HTML of that is going to be blank to an inner HTML of that is
going to be blank.
We also want to check to see if the my words are right, length is greater than zero, and if it is
then we can run the function.
Otherwise we're going to put to the console no more words.
So let's try that now.
So we start, we get the solution.
We can start again as we click through.
So once we solve this one and now the last one and once we've solved it, we get no more words.
So we've got our completion taking the value of the number of letters that were guessed, as well as
how many are currently already solved, and then subtracting that from the number of characters that
are available to be solved.
Give us our completion solution.
Coming up next, we need to output some messaging to the player and clean up some of the gameplay.