1
00:00:00,600 --> 00:00:05,580
So and just listen I'm going to finish the tiles and make them show up what's in the horizontal axis

2
00:00:05,640 --> 00:00:10,810
as well as the vertical axis and that's good to exclude and see how we're going to do that.

3
00:00:10,920 --> 00:00:16,870
This piece of code essentially produces four tiles for me on the horizontal level.

4
00:00:16,950 --> 00:00:22,140
So they have to do is I have to duplicate these four times on the vertical level which is going to be

5
00:00:22,230 --> 00:00:23,070
very simple.

6
00:00:23,070 --> 00:00:29,410
I'm going to save for this call this one a V in 0 until game mode.

7
00:00:29,730 --> 00:00:31,620
Just like what we had done before.

8
00:00:31,800 --> 00:00:34,920
Let's repeat the entire h order up.

9
00:00:35,010 --> 00:00:41,200
So if I reformat this it becomes a little clearer to see it that we are repeating the same thing that's

10
00:00:41,220 --> 00:00:43,210
happening four times.

11
00:00:43,320 --> 00:00:45,610
If you're doing it four times.

12
00:00:45,690 --> 00:00:50,920
However if we do this right now it's not going to really work the way we were expecting it.

13
00:00:51,080 --> 00:00:53,120
And I mis wrote that.

14
00:00:53,130 --> 00:00:55,350
So it's like that.

15
00:00:55,620 --> 00:01:04,980
So it's not that I actually push them down one step at a time so every time we finish one set of H times

16
00:01:05,240 --> 00:01:09,290
what we have to do is we have to say the same thing that happened in here.

17
00:01:09,300 --> 00:01:14,740
But for the void you have to say why seven plus equal type size.

18
00:01:14,790 --> 00:01:18,170
So Devoy goes down one level.

19
00:01:18,190 --> 00:01:23,720
However every time we finish the H we have to reset the X.

20
00:01:23,900 --> 00:01:29,880
So I'm going to say X then becomes tile size divided by two.

21
00:01:29,940 --> 00:01:37,250
So like that we make sure that every time that we go through one set of the horizontal all the columns

22
00:01:37,530 --> 00:01:43,240
and we want to produce the next row for the next throw We reset everything back to the very beginning

23
00:01:43,680 --> 00:01:47,270
but we push everything down as much as one tiny size.

24
00:01:47,520 --> 00:01:49,760
Let's see how that works for us.

25
00:01:52,000 --> 00:01:56,580
Now as you can see if you have all the 16 times in here obviously they don't do anything or they don't

26
00:01:56,580 --> 00:02:01,350
show anything and that's something we have to have to work with right now because we want to be able

27
00:02:01,350 --> 00:02:05,090
to see something visible on each of these labels.

28
00:02:05,130 --> 00:02:12,350
So I'm going here when I make the time I'm going to get say every tile has a very large font.

29
00:02:12,390 --> 00:02:17,780
So it's going to be you I font system font of size are you.

30
00:02:17,780 --> 00:02:21,860
I found that system fond of size.

31
00:02:22,110 --> 00:02:24,470
I want to make it somewhere about.

32
00:02:24,960 --> 00:02:32,130
This is an iPad so I could actually go all the way to about 50 for instance I want to have a ball.

33
00:02:32,490 --> 00:02:33,240
Wait for it.

34
00:02:33,240 --> 00:02:35,120
So it's actually quite clear.

35
00:02:35,310 --> 00:02:45,110
Then I'm going to say each time Dot tile dot text alignment becomes less a alignment thoughts center.

36
00:02:45,120 --> 00:02:46,860
So they are all in the center.

37
00:02:46,860 --> 00:02:49,710
And now I have to produce a number for each of them.

38
00:02:49,710 --> 00:02:54,200
So essentially we have to be able to see a value for them in here.

39
00:02:54,270 --> 00:03:03,000
And for now we're going to make them numeric values so it's going to be 0 1 2 3 4 5 6 7 so on and so

40
00:03:03,000 --> 00:03:06,670
forth we're going to throw all the numbers all the way to the end so to do that.

41
00:03:06,690 --> 00:03:12,240
I'm going to go ahead and show you a little bit of a mathematical formula but then I'm going to simplify

42
00:03:12,240 --> 00:03:14,250
it and write it an easier way.

43
00:03:14,410 --> 00:03:20,180
Then mathematical They are fighting this would simply be saying tile dots text.

44
00:03:20,220 --> 00:03:31,950
There's value that you're trying to produce is this is going to be what ever we have on the h h h plus

45
00:03:32,340 --> 00:03:37,660
whatever we have in the V multiplied by game mode.

46
00:03:37,980 --> 00:03:45,690
And the reason for that is this when we are on the V zero which is this one the top row.

47
00:03:45,930 --> 00:03:53,990
Then we get the numbers 0 1 2 3 and we come to this one in here we get to V which is one multiplied

48
00:03:53,990 --> 00:03:55,730
by game mode which is four.

49
00:03:55,740 --> 00:03:59,010
So we add four on top of 0 1 220.

50
00:03:59,010 --> 00:04:01,610
So it becomes 4 5 6 seven.

51
00:04:01,620 --> 00:04:03,090
So on and so forth.

52
00:04:03,090 --> 00:04:04,710
Let's see if that actually works.

53
00:04:06,460 --> 00:04:12,830
And that's giving us numbers from 0 to 15 which is the 16 tilers in here not if this is something that

54
00:04:12,830 --> 00:04:15,240
you're comfortable with that's perfectly fine.

55
00:04:15,250 --> 00:04:19,670
We can use it like this if this is something that you feel like you know you want to have an easier

56
00:04:19,670 --> 00:04:20,490
solution.

57
00:04:20,510 --> 00:04:24,050
I'm going to show you another solution and perhaps an easier solution.

58
00:04:24,120 --> 00:04:25,180
And the easiest solution.

59
00:04:25,200 --> 00:04:32,810
I'm going to introduce a new variable up here and what I call this valuable counter which is by default

60
00:04:32,810 --> 00:04:33,640
the zero.

61
00:04:33,920 --> 00:04:43,000
And so every time we produce an actual tile we use that to value counter to show the text in here.

62
00:04:43,090 --> 00:04:46,050
I'm going to say the value is actually counter.

63
00:04:46,340 --> 00:04:53,150
And of course every time we make a tile and we show it I'm going to say counter plus equal one it adds

64
00:04:53,150 --> 00:04:54,510
1 to itself.

65
00:04:54,560 --> 00:04:59,810
And if Iran is now we should be able to see essentially exactly the same thing.

66
00:04:59,830 --> 00:05:01,940
There's zero to 16.

67
00:05:01,940 --> 00:05:03,050
Zero to 15.

68
00:05:03,050 --> 00:05:09,750
Based on the counter the only defense in here right now is we are not using the V an H for anything.

69
00:05:09,770 --> 00:05:15,080
So I could essentially replace them with underscores because I don't want to have warnings for no good

70
00:05:15,080 --> 00:05:15,690
reason.

71
00:05:15,860 --> 00:05:21,870
So depending on what you choose to do you could either keep them or you can just make counter.

72
00:05:22,010 --> 00:05:27,890
There is however another thing that we still have to do in here and that is very important because this

73
00:05:27,890 --> 00:05:34,340
is a memory game and we need to have pairs of tiles we have to make sure that whatever numbers we get

74
00:05:34,730 --> 00:05:37,400
at some point we get the mirror off them.

75
00:05:37,400 --> 00:05:43,590
So essentially if this is a four by four game we should have eight styles and then another eight others

76
00:05:43,610 --> 00:05:45,400
which are exactly like those guys.

77
00:05:45,530 --> 00:05:47,260
So essentially zero to seven.

78
00:05:47,330 --> 00:05:52,070
And then again 007 don't worry about randomising it just yet.

79
00:05:52,070 --> 00:05:54,800
For now let's just make the tiles in order.

80
00:05:55,010 --> 00:06:00,890
So to do that I'm going to go ahead in here and say every time that I want to show the counter I'm going

81
00:06:00,890 --> 00:06:17,690
to test I'm going to say if the counter is already larger than game mod multiplied by game mode divided

82
00:06:17,720 --> 00:06:25,270
by 2 if that has happened then what we have to do is we have to reset the counter to zero.

83
00:06:25,430 --> 00:06:31,880
So if Actually I shouldn't have used larger and this is one of those things that I said that you can

84
00:06:31,880 --> 00:06:34,070
to know exactly what's coming up.

85
00:06:34,100 --> 00:06:41,960
So if the counter reaches a number such as 8 we shouldn't produce it because that's that we should say

86
00:06:41,960 --> 00:06:46,020
0 to 7 and then at 8 it has to become zero again.

87
00:06:46,130 --> 00:06:53,990
So if counter becomes equal to game more per game more divided by 2 which is half the between deck tiles

88
00:06:54,290 --> 00:06:58,500
then we have to reset the counter and then we keep adding to the counter again.

89
00:06:58,520 --> 00:07:02,570
So it goes from 0 to 7 and then goes from 0 to 7 again.

90
00:07:02,900 --> 00:07:05,900
Let's see if that works the way I'm explaining it.

91
00:07:05,900 --> 00:07:09,920
So here we have a zero to seven and another zero to seven.

92
00:07:10,010 --> 00:07:11,990
So that's about it for this lesson.

93
00:07:11,990 --> 00:07:19,490
By now we have all of our titles going from 0 2 0 7 0 0 to 7 is 16 of them and I'm just going to manually

94
00:07:19,490 --> 00:07:22,350
change something to show you that everything is working.

95
00:07:22,400 --> 00:07:28,400
If you've been in a game mode such as six then we should be able to see six six thirty six.

96
00:07:28,420 --> 00:07:32,990
We should be able to see 18 0 to 17 and 0 to 17.

97
00:07:33,080 --> 00:07:34,880
And that's working again as well.

98
00:07:35,000 --> 00:07:37,070
So everything is working up until now.

99
00:07:37,100 --> 00:07:40,540
We have all the toys are obviously no interaction or nothing yet.

100
00:07:40,760 --> 00:07:43,090
I'm going to reset this back to 4.

101
00:07:43,100 --> 00:07:46,450
So if we go back to what we had and I want to show you something else.

102
00:07:46,460 --> 00:07:54,260
For those of you who chose to stay with their V and H mechanism because in your it's very easy to reset

103
00:07:54,290 --> 00:07:55,160
the counter.

104
00:07:55,310 --> 00:07:58,780
But if you are using those values then you have to do something like this.

105
00:07:58,790 --> 00:08:10,580
You have to say if h plus V multiplied by game mode if that value is a cube and two game moves by game

106
00:08:10,670 --> 00:08:21,230
mode divided by two if it got there then from this point on you have to get the value this value and

107
00:08:21,230 --> 00:08:31,440
then from that you have to subtract half because these values and you can change them just like counters.

108
00:08:31,670 --> 00:08:35,460
But rather you have to actually get the value and subtract from it.

109
00:08:35,540 --> 00:08:37,750
And let me explain to you what it means.

110
00:08:37,760 --> 00:08:41,590
It means that as long as you haven't reached let's say eight.

111
00:08:41,690 --> 00:08:52,230
So the numbers they go up 1 2 3 4 5 6 7 0 4 0 0 for one euro OK all the way to when we reach seven.

112
00:08:52,280 --> 00:08:58,030
But when you reach eight is it going to subtract from itself half of the numbers.

113
00:08:58,040 --> 00:09:02,570
Which is another eight which obviously produces zero again.

114
00:09:02,690 --> 00:09:07,930
So many creatures and numbers such as I don't know for mean that is going to subtract eight from me.

115
00:09:07,960 --> 00:09:09,730
And it produces six again.

116
00:09:09,940 --> 00:09:16,510
So for those of you who chose to go with an ancient system I keep in mind that you can reset it like

117
00:09:16,510 --> 00:09:16,780
this.

118
00:09:16,780 --> 00:09:19,210
You have to reset it slightly differently.

119
00:09:19,210 --> 00:09:22,120
We all however are continuing with the counter mode.

120
00:09:22,180 --> 00:09:28,420
And if you don't worry about that then it's much easier for you right now.

121
00:09:28,420 --> 00:09:31,490
So with that in mind let's move on to our next lesson.
