1
00:00:00,390 --> 00:00:02,790
I'm going to update our word ouray.

2
00:00:04,360 --> 00:00:10,810
So it's a lot simpler for me and I can really easily do the solution because coming in now, we want

3
00:00:10,810 --> 00:00:14,800
to have a quick and easy way to test out the solutions.

4
00:00:15,490 --> 00:00:22,210
So I brought that down to contain strings of A, B, B or C, C, so now we have a simpler array to

5
00:00:22,210 --> 00:00:23,770
work with of letters.

6
00:00:24,810 --> 00:00:32,580
Let's apply some of our logic, creating another value to guess, we'll call it guess, and this is

7
00:00:32,580 --> 00:00:37,380
going to count how many of the letters the player got.

8
00:00:37,890 --> 00:00:42,180
So when they come in, it starts out at zero as we loop through the solution.

9
00:00:43,080 --> 00:00:49,590
So as we look through all of these available characters, we can see that if this increases, then that

10
00:00:49,590 --> 00:00:53,070
means that the player gets a certain number of them correctly.

11
00:00:53,880 --> 00:01:01,650
So after we complete our loop, we can check to see if the value of guess is greater than zero.

12
00:01:02,430 --> 00:01:06,030
And if it is that we know that the guest multiple values.

13
00:01:06,030 --> 00:01:06,410
Correct.

14
00:01:07,260 --> 00:01:08,910
So your solution is C..

15
00:01:09,610 --> 00:01:11,930
So we can say you found two letters.

16
00:01:12,390 --> 00:01:15,080
We can also calculate out how many letters are left.

17
00:01:15,090 --> 00:01:16,400
This is no list.

18
00:01:16,410 --> 00:01:17,640
So it does have a length.

19
00:01:17,650 --> 00:01:24,750
If we subtract the value of guess plus counter, that's going to give us a value of how many letters

20
00:01:24,750 --> 00:01:25,290
are left.

21
00:01:25,290 --> 00:01:31,170
And we can log that out to the console as well to see that you found two letters and there's zero letters

22
00:01:31,170 --> 00:01:33,180
left is less than one.

23
00:01:33,360 --> 00:01:35,400
That means that they've solved the puzzle.

24
00:01:35,400 --> 00:01:42,060
And we want to show the start button again, updating the style display to equal block.

25
00:01:42,480 --> 00:01:43,880
So that's going to show up again.

26
00:01:43,890 --> 00:01:47,320
And so we get our start button again and we can start the game again.

27
00:01:47,580 --> 00:01:52,840
Notice that what happened here is we didn't get rid of what we currently had in place.

28
00:01:53,700 --> 00:01:56,010
We have to clean up some of the content.

29
00:01:56,700 --> 00:02:04,380
So we've got output one and the inner HTML of that is going to be blank to an inner HTML of that is

30
00:02:04,380 --> 00:02:05,070
going to be blank.

31
00:02:05,280 --> 00:02:13,380
We also want to check to see if the my words are right, length is greater than zero, and if it is

32
00:02:13,380 --> 00:02:15,410
then we can run the function.

33
00:02:15,450 --> 00:02:19,580
Otherwise we're going to put to the console no more words.

34
00:02:20,040 --> 00:02:21,200
So let's try that now.

35
00:02:21,240 --> 00:02:23,580
So we start, we get the solution.

36
00:02:23,850 --> 00:02:26,080
We can start again as we click through.

37
00:02:26,100 --> 00:02:32,210
So once we solve this one and now the last one and once we've solved it, we get no more words.

38
00:02:32,220 --> 00:02:40,170
So we've got our completion taking the value of the number of letters that were guessed, as well as

39
00:02:40,170 --> 00:02:47,070
how many are currently already solved, and then subtracting that from the number of characters that

40
00:02:47,070 --> 00:02:50,130
are available to be solved.

41
00:02:50,370 --> 00:02:52,820
Give us our completion solution.

42
00:02:52,860 --> 00:02:57,990
Coming up next, we need to output some messaging to the player and clean up some of the gameplay.
