So and just listen I'm going to finish the tiles and make them show up what's in the horizontal axis
as well as the vertical axis and that's good to exclude and see how we're going to do that.
This piece of code essentially produces four tiles for me on the horizontal level.
So they have to do is I have to duplicate these four times on the vertical level which is going to be
very simple.
I'm going to save for this call this one a V in 0 until game mode.
Just like what we had done before.
Let's repeat the entire h order up.
So if I reformat this it becomes a little clearer to see it that we are repeating the same thing that's
happening four times.
If you're doing it four times.
However if we do this right now it's not going to really work the way we were expecting it.
And I mis wrote that.
So it's like that.
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
what we have to do is we have to say the same thing that happened in here.
But for the void you have to say why seven plus equal type size.
So Devoy goes down one level.
However every time we finish the H we have to reset the X.
So I'm going to say X then becomes tile size divided by two.
So like that we make sure that every time that we go through one set of the horizontal all the columns
and we want to produce the next row for the next throw We reset everything back to the very beginning
but we push everything down as much as one tiny size.
Let's see how that works for us.
Now as you can see if you have all the 16 times in here obviously they don't do anything or they don't
show anything and that's something we have to have to work with right now because we want to be able
to see something visible on each of these labels.
So I'm going here when I make the time I'm going to get say every tile has a very large font.
So it's going to be you I font system font of size are you.
I found that system fond of size.
I want to make it somewhere about.
This is an iPad so I could actually go all the way to about 50 for instance I want to have a ball.
Wait for it.
So it's actually quite clear.
Then I'm going to say each time Dot tile dot text alignment becomes less a alignment thoughts center.
So they are all in the center.
And now I have to produce a number for each of them.
So essentially we have to be able to see a value for them in here.
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
forth we're going to throw all the numbers all the way to the end so to do that.
I'm going to go ahead and show you a little bit of a mathematical formula but then I'm going to simplify
it and write it an easier way.
Then mathematical They are fighting this would simply be saying tile dots text.
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
whatever we have in the V multiplied by game mode.
And the reason for that is this when we are on the V zero which is this one the top row.
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
by game mode which is four.
So we add four on top of 0 1 220.
So it becomes 4 5 6 seven.
So on and so forth.
Let's see if that actually works.
And that's giving us numbers from 0 to 15 which is the 16 tilers in here not if this is something that
you're comfortable with that's perfectly fine.
We can use it like this if this is something that you feel like you know you want to have an easier
solution.
I'm going to show you another solution and perhaps an easier solution.
And the easiest solution.
I'm going to introduce a new variable up here and what I call this valuable counter which is by default
the zero.
And so every time we produce an actual tile we use that to value counter to show the text in here.
I'm going to say the value is actually counter.
And of course every time we make a tile and we show it I'm going to say counter plus equal one it adds
1 to itself.
And if Iran is now we should be able to see essentially exactly the same thing.
There's zero to 16.
Zero to 15.
Based on the counter the only defense in here right now is we are not using the V an H for anything.
So I could essentially replace them with underscores because I don't want to have warnings for no good
reason.
So depending on what you choose to do you could either keep them or you can just make counter.
There is however another thing that we still have to do in here and that is very important because this
is a memory game and we need to have pairs of tiles we have to make sure that whatever numbers we get
at some point we get the mirror off them.
So essentially if this is a four by four game we should have eight styles and then another eight others
which are exactly like those guys.
So essentially zero to seven.
And then again 007 don't worry about randomising it just yet.
For now let's just make the tiles in order.
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
to test I'm going to say if the counter is already larger than game mod multiplied by game mode divided
by 2 if that has happened then what we have to do is we have to reset the counter to zero.
So if Actually I shouldn't have used larger and this is one of those things that I said that you can
to know exactly what's coming up.
So if the counter reaches a number such as 8 we shouldn't produce it because that's that we should say
0 to 7 and then at 8 it has to become zero again.
So if counter becomes equal to game more per game more divided by 2 which is half the between deck tiles
then we have to reset the counter and then we keep adding to the counter again.
So it goes from 0 to 7 and then goes from 0 to 7 again.
Let's see if that works the way I'm explaining it.
So here we have a zero to seven and another zero to seven.
So that's about it for this lesson.
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
change something to show you that everything is working.
If you've been in a game mode such as six then we should be able to see six six thirty six.
We should be able to see 18 0 to 17 and 0 to 17.
And that's working again as well.
So everything is working up until now.
We have all the toys are obviously no interaction or nothing yet.
I'm going to reset this back to 4.
So if we go back to what we had and I want to show you something else.
For those of you who chose to stay with their V and H mechanism because in your it's very easy to reset
the counter.
But if you are using those values then you have to do something like this.
You have to say if h plus V multiplied by game mode if that value is a cube and two game moves by game
mode divided by two if it got there then from this point on you have to get the value this value and
then from that you have to subtract half because these values and you can change them just like counters.
But rather you have to actually get the value and subtract from it.
And let me explain to you what it means.
It means that as long as you haven't reached let's say eight.
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.
But when you reach eight is it going to subtract from itself half of the numbers.
Which is another eight which obviously produces zero again.
So many creatures and numbers such as I don't know for mean that is going to subtract eight from me.
And it produces six again.
So for those of you who chose to go with an ancient system I keep in mind that you can reset it like
this.
You have to reset it slightly differently.
We all however are continuing with the counter mode.
And if you don't worry about that then it's much easier for you right now.
So with that in mind let's move on to our next lesson.