1
00:00:00,300 --> 00:00:01,510
So it will come back again.

2
00:00:01,530 --> 00:00:07,060
In this listen we have to find a way to compare the two ties that we have just revealed.

3
00:00:07,110 --> 00:00:11,690
Now before I go into the quote I should explain to you how you are planning to do this thing.

4
00:00:11,910 --> 00:00:13,300
Let me go to the simulator.

5
00:00:13,410 --> 00:00:15,210
Here is our situation.

6
00:00:15,210 --> 00:00:21,970
I tap on one time that's one Philips and we see a number on it and this is not the time we have to compare.

7
00:00:22,270 --> 00:00:25,300
It might happen another time and we see another number.

8
00:00:25,400 --> 00:00:27,220
Now we have to compare them.

9
00:00:27,450 --> 00:00:31,870
So why what they just said we have to infer a few things.

10
00:00:31,890 --> 00:00:36,570
First of all we have to remember whether this is the time to compare or not.

11
00:00:36,570 --> 00:00:43,000
Second thing we have to remember what we tapped on in the very first attempt and what we're tapping

12
00:00:43,050 --> 00:00:44,270
on this time.

13
00:00:44,400 --> 00:00:46,000
And then we have to reset this.

14
00:00:46,140 --> 00:00:51,120
So once I got five on one that's a pair that's going to be compared against each other.

15
00:00:51,180 --> 00:00:56,660
And now when I tap again and again these will have to be compared against one another.

16
00:00:56,850 --> 00:00:58,760
So let's go ahead and quote them right.

17
00:00:58,760 --> 00:00:59,810
All of that down.

18
00:01:00,030 --> 00:01:03,130
I'm going to say give my view controller.

19
00:01:03,260 --> 00:01:05,260
I have a few new valuables.

20
00:01:05,280 --> 00:01:09,570
I have a valuable call first time.

21
00:01:09,810 --> 00:01:12,140
That's going to be a my label.

22
00:01:12,360 --> 00:01:15,760
I have a viable let's call it the second time.

23
00:01:15,960 --> 00:01:18,010
That's also my label.

24
00:01:18,030 --> 00:01:20,190
So these are the toys that we tap on.

25
00:01:20,190 --> 00:01:21,360
One other time.

26
00:01:21,360 --> 00:01:23,930
First one second one first one second one.

27
00:01:23,990 --> 00:01:26,200
I just keeps going on like this.

28
00:01:26,250 --> 00:01:33,990
Then I have a VAT and this one I'm going to call compare now and this is by default false because this

29
00:01:33,990 --> 00:01:39,030
is the state of the game whether we should compare right now or not at the beginning.

30
00:01:39,030 --> 00:01:40,100
We shouldn't compare.

31
00:01:40,140 --> 00:01:42,010
Now we should compare.

32
00:01:42,240 --> 00:01:45,890
Now we shouldn't compare again because we're getting another one.

33
00:01:45,940 --> 00:01:48,090
Now we're comparing against five.

34
00:01:48,090 --> 00:01:49,550
So we should come back.

35
00:01:49,740 --> 00:01:54,720
Now let's see how are we going to change these values to reflect what I just suggested.

36
00:01:54,750 --> 00:02:00,900
To do that I'm going to go ahead into a metal that we call touches in that nuthatches and that I have

37
00:02:00,900 --> 00:02:02,930
to decide about a few things.

38
00:02:02,970 --> 00:02:05,150
The most important one are these.

39
00:02:05,460 --> 00:02:12,210
If I found a top high tide I have to find out that this is the first time or the second time.

40
00:02:12,420 --> 00:02:19,710
So I'm going to go ahead and say if I can compare Now if this is the time to compare you have to do

41
00:02:19,860 --> 00:02:22,780
something else you have to do other things.

42
00:02:23,100 --> 00:02:28,870
And the other thing is that we have to do if we are comparing it means this is the second time we have

43
00:02:28,870 --> 00:02:29,500
stopped.

44
00:02:29,700 --> 00:02:34,400
And that means second time becomes top tied.

45
00:02:34,740 --> 00:02:42,000
If this wasn't the case if we're in the else it means first time is tops tied.

46
00:02:42,180 --> 00:02:49,870
So depending on which type of your on the day it is compare mode or not we decide about our two tiles.

47
00:02:50,100 --> 00:02:55,360
Now we got the tile set up over there and then we have to do reveal for them.

48
00:02:55,410 --> 00:03:01,050
So if this is the very first time we're doing this you should just reveal it which is the function we

49
00:03:01,050 --> 00:03:02,350
already have.

50
00:03:02,820 --> 00:03:08,100
If this is the second time we're doing it we have to review and compare.

51
00:03:08,250 --> 00:03:10,620
And that's a function we don't have yet.

52
00:03:10,800 --> 00:03:13,700
So let me go ahead and add that I'm going to say come on.

53
00:03:13,710 --> 00:03:24,280
And this one I'm going to call the View Controller plus review and compare

54
00:03:27,640 --> 00:03:35,050
your import you I can't I'm going to say this is an extension of you controller.

55
00:03:35,320 --> 00:03:44,340
There is a function it's called reveal and compare and it does take just like the previous review.

56
00:03:44,360 --> 00:03:46,020
It takes an input value.

57
00:03:46,130 --> 00:03:48,450
So I'm going to call that exactly the same thing.

58
00:03:48,680 --> 00:03:49,980
So it's easier for me.

59
00:03:50,970 --> 00:03:55,140
And then I'm going to say within it we need another transition.

60
00:03:55,140 --> 00:03:58,590
So you gave you that transition.

61
00:03:58,590 --> 00:04:03,920
Now let's talk quickly about what's the difference between this one and the reveal that you had before

62
00:04:04,500 --> 00:04:10,950
the previous one flip to reveal essentially makes an animation to reveal what's shown behind it.

63
00:04:10,950 --> 00:04:13,440
And I could actually copy a lot of these things.

64
00:04:13,440 --> 00:04:16,030
I could copy almost all of these.

65
00:04:16,140 --> 00:04:24,210
Now we have to say do all of that once you're done with the animation and that is happening in the completion

66
00:04:24,210 --> 00:04:29,520
block once you reach the completion block you should also do something here.

67
00:04:29,580 --> 00:04:34,130
The last thing we didn't have anything happening in the completion to completion was nil.

68
00:04:34,200 --> 00:04:37,060
This time we are doing something in the completion.

69
00:04:37,110 --> 00:04:44,930
So I replaced all of that and in here in the completion BLOCK Let me add it that's a bit cleaner in

70
00:04:44,940 --> 00:04:45,650
the completion.

71
00:04:45,660 --> 00:04:49,620
I'm going to call the completion value of a raise even though it doesn't really matter.

72
00:04:49,620 --> 00:04:57,550
I'm not going to use it and I'm going to say in the completion actually do compare do compare.

73
00:04:57,660 --> 00:04:59,970
Now we haven't really done this far.

74
00:05:00,050 --> 00:05:02,760
We don't know what they comprise and it's going to be.

75
00:05:02,850 --> 00:05:05,440
But that's a function we still have to write.

76
00:05:05,920 --> 00:05:07,620
Oh let's see how we're going to do that.

77
00:05:07,650 --> 00:05:14,850
And we'll actually go ahead and then you find I'm going to call this on View Controller.

78
00:05:15,030 --> 00:05:16,950
Plus compare

79
00:05:20,000 --> 00:05:22,700
this one again has everything is before you.

80
00:05:22,700 --> 00:05:23,820
I can't.

81
00:05:23,990 --> 00:05:32,620
It is an extension to view controller and it has only one function it's called compare and they compare

82
00:05:32,630 --> 00:05:37,620
function should give us like the two of them are similar or not.

83
00:05:37,970 --> 00:05:43,400
Now before we can write or compare function we have to fix a few things one of them is I have to go

84
00:05:43,400 --> 00:05:50,070
to my touches and it and I have to add that new function that we made that's called reveal and compare.

85
00:05:50,240 --> 00:05:57,290
So I'm going to come in here and say in the compare now mode if that's the time I'm Vicot the second

86
00:05:57,290 --> 00:06:01,240
time do this reveal it and compare it.

87
00:06:01,490 --> 00:06:07,940
And we are revealing the second time because again the top died and we are comparing the two of them

88
00:06:07,940 --> 00:06:09,250
against each other.

89
00:06:09,270 --> 00:06:15,740
Here is something very important we never end up in the comparing now currently because comparing now

90
00:06:15,740 --> 00:06:19,780
is false at the beginning and every time we come here it stays like that.

91
00:06:19,790 --> 00:06:26,040
So something else I have to do is I have to say once you make this decision reset the computer now.

92
00:06:26,180 --> 00:06:29,940
So comparing now becomes the opposite of what the campaign is.

93
00:06:30,080 --> 00:06:33,720
So if this is the first time comparing now is false it becomes true.

94
00:06:33,830 --> 00:06:38,140
If this was the second time compare now was true make it false.

95
00:06:38,300 --> 00:06:44,650
Now why now we have a situation where we end up you know revealed and compare which is here.

96
00:06:44,930 --> 00:06:49,510
We reveal the second time and now we have to compare in the completion.

97
00:06:49,640 --> 00:06:58,130
And this is the part that says to compare which is the new function self dot compare not to compare

98
00:06:58,130 --> 00:07:01,470
Now compare function compare function.

99
00:07:01,490 --> 00:07:06,890
So now we have the cells that compare happening and I'm going to go back to compare in here.

100
00:07:06,890 --> 00:07:09,180
I'm going to say well why now.

101
00:07:09,200 --> 00:07:14,960
We have the first time we have this I can type it and you have to tell us if they are the same which

102
00:07:14,960 --> 00:07:25,040
is very easy if the first time that internal number is second time that internal number then obviously

103
00:07:25,040 --> 00:07:27,730
they are the same else they are different.

104
00:07:27,950 --> 00:07:34,370
So for now and just for this listen I'm going to only print that I'm going to say print in print I'm

105
00:07:34,370 --> 00:07:40,940
going to say same and yet I'm going to say different.

106
00:07:41,240 --> 00:07:44,600
Let's see if that's going to work for me if I run this application now.

107
00:07:44,600 --> 00:07:46,430
And it happened two times.

108
00:07:46,430 --> 00:07:51,680
They should reveal they should show me the numbers and if they are the same numbers it should tell me

109
00:07:51,690 --> 00:07:52,310
same.

110
00:07:52,430 --> 00:07:55,960
And if they are not it should tell me are different essentially.

111
00:07:56,240 --> 00:07:58,240
So here I got the first one.

112
00:07:58,280 --> 00:07:59,170
One.

113
00:07:59,240 --> 00:08:00,270
Now they compare.

114
00:08:00,270 --> 00:08:01,760
Now is true.

115
00:08:02,080 --> 00:08:05,100
The next one for and they are different.

116
00:08:05,240 --> 00:08:12,360
If I it out again five and I bought another one zero different I've got four.

117
00:08:12,410 --> 00:08:18,550
Now when I really tap on for even though we haven't flipped it back for I it says they are the same.

118
00:08:18,630 --> 00:08:19,740
Let me find another one.

119
00:08:19,740 --> 00:08:21,930
Three on one.

120
00:08:21,990 --> 00:08:25,900
Are obviously different but the one and one are the same.

121
00:08:25,910 --> 00:08:30,430
So in this lesson in our view controller we are of the few in your valuables.

122
00:08:30,440 --> 00:08:37,710
First time second time and compare Now status then driven to the touches and touches and we decided

123
00:08:37,770 --> 00:08:39,530
that depending on the compare.

124
00:08:39,530 --> 00:08:41,120
Now start this video.

125
00:08:41,120 --> 00:08:46,520
The second time should be the one we just tapped on or the first line should be the one we just hopped

126
00:08:46,520 --> 00:08:47,150
on.

127
00:08:47,150 --> 00:08:54,440
Depending on which one happened we either only flipped or flipped and compared and of course at the

128
00:08:54,440 --> 00:08:58,650
end of each of them will reset the value of compair now.

129
00:08:58,760 --> 00:09:05,980
Now in our Reveal and compare what we did is revealing the toilet which was what he had done before.

130
00:09:06,140 --> 00:09:11,660
And in its completion block we said also compared the two times against each other.

131
00:09:11,840 --> 00:09:18,860
And then they compare the simply found the internal number of 1 and 2 and they compared them against

132
00:09:18,860 --> 00:09:19,850
each other.

133
00:09:19,850 --> 00:09:22,010
Now that's all we have to do for this lesson.

134
00:09:22,010 --> 00:09:27,080
I want to mention something to you and that's just if somebody was interested to do things a little

135
00:09:27,080 --> 00:09:34,340
bit more differently you could actually use the same one flip to reveal for most of these revealed actions

136
00:09:34,640 --> 00:09:38,730
you could actually completely trivial in the completion block of it.

137
00:09:38,780 --> 00:09:39,520
Right.

138
00:09:39,530 --> 00:09:44,190
If we are in the compair now also do the comparison.

139
00:09:44,300 --> 00:09:45,610
That's something you could do.

140
00:09:45,620 --> 00:09:50,660
I don't want to make it overly complicated that's why I wrote two different functions which are very

141
00:09:50,660 --> 00:09:51,550
very similar.

142
00:09:51,710 --> 00:09:59,660
So essentially you could use this very function if in here you had enough self that compare.

143
00:09:59,660 --> 00:10:02,390
Now then do compare.

144
00:10:02,430 --> 00:10:08,750
Otherwise don't do anything and use the very same function for most of the events that happens in the

145
00:10:08,750 --> 00:10:13,490
Thatchers and that but I'll leave that to you to decide how you want to proceed with it.

146
00:10:13,490 --> 00:10:20,090
So with that in mind we have an app that now can show us two different tiles and can compare them against

147
00:10:20,090 --> 00:10:20,930
each other.

148
00:10:20,960 --> 00:10:22,580
It doesn't really set them back.

149
00:10:22,580 --> 00:10:25,320
So let's move on to the next person to fix that one.
