So will come back again in this lesson we actually have to do something that is kind of a pro vision
for the upcoming lesson.
So let me go to school and explain why you have to ask for our toil.
Great.
So the next quote I'm going to write this down as comments so we kind of remember what you have to do
sometimes down the track.
We have to be able to randomize the times.
So basically the ties that I have here on the simulator are that all in all there were 0 2 7 9 0 7.
We have to randomize them and in order to randomize it I have a strategy in mind so I'm going to write
that down for you.
You might be able to come up with a different solution but this is going to be my solution for now and
I'm sure there are better ones out there but my solution is this.
Let's remember all the toys let's remember all the sensors if you remember replaced each time in a certain
center.
Then let's go through the tiles and assign a random center.
So here's the strategy I'm going to show it up and we'll show you the simulator as they talk about it.
My strategy is to remember all the title song that maybe in an array.
And then I remember all the centers thing going through all the tiles and randomly find new centers
assigned to them.
So this time that has zero maybe gets this space for this child is number two and then decide which
is six maybe gets this space for zero used to be so on and so forth.
We randomized the entire grade and every time we can read on the why is it just pressing or resets.
Why then are rerunning random function.
Now that is something that we have to do in the next lesson in this lesson.
However we have to do this for remembering the toys and the sensors and to do that I'm actually going
to go ahead and introduce two new variables.
I'm going to say I have a value.
I'm going to call it tiles array.
And this whole area is going to be an array of the objects that we are using and I don't write it right
away I want to show you for what that is.
That object is this one my label because you're using my label to create the tiles.
So it's going to be tiles array an array of my Lieben.
And that is going to be an optional value because we don't have anything in it right at the very beginning.
That's one way of doing it or if you wanted you could actually set it to an empty array at the very
beginning.
Now this is a more swift approach of doing things.
If you're using any other programming language like Objective-C this would be in less of an option for
you but for now it could actually it started with an empty array.
Or am I ever going to make sure that every time that we want to make tiles and this is something that
could happen in our game we might want to make new set of tiles.
I'm going to set these tiles array to be a game and in theory and you could add the semicolon here or
not.
I'm kind of used to some other programming languages notably Java on the C-sharp that I have to other
semicolon but you don't really have to remove it for now.
The other thing we wrote in here was remembering all the.
So I actually our let's call this one censor's array and that is going to be an array of CGV points.
And that's going to be an empty one at the very beginning as well.
And again I will remember every time that they come to making the tiles I'm going to set that to a new
one as well.
So now we have an array for ties an array for centers and they are empty at the very beginning and they
are ready to take on the values.
But nobody's actually adding any values to them.
We are not appending anything to them.
So let's go ahead and do that.
I'm going to come down here where I build new tiles and I'm going to say every time you made a tile
and you made a new center and you gave it the right internal number you showed the right value on them.
Let's go ahead and do this.
The order of it doesn't necessarily matter in here.
I kind of like to put my code in an order that makes sense.
I want the tiles to have the right internal number and they show the right text on them and then I'm
going to say tiles are a dot a pen.
And he's asking for a new object of the type of my labor.
And that is of course trial.
And then I'm going to go ahead and say centers are a dot a pen and you know I have to at this center
I just created this one.
Tyler said.
So we have that now we have both the tiles and the center's return into an array.
Every time Major tiles is being called so we emptied both of them in case they had something in them
and we added all the floor tiles and centers into the two areas in here.
Now in this lesson there isn't really any way for you to test this for that it worked or not except
if you want to print.
And that's what I'm going to do I'm going to go to my view a lot after make tiles that I know the toys
by now should be populated and they should be written into the Toys R 8 and the centers should be populated.
I returned to the centers array.
I'm going to say Prince and into print I'm going to say I want to print these tiles on earth and then
find what ever you can in the tiles array and then I'm going to copy this and say centers are of course
that's going to be centers.
Ali I want to keep in mind that the tiles are great even though it does pre-NST doesn't really make
much of a sense because it shows us an outlet that eases the air but there isn't really any value that
we can read and understand from it what we could understand are the symptoms shows actual locations.
So once it prints out and the application loads up we get all of these different values that for instance
says we have a tile as our memory puzzle the game my label based classes label.
This is the frame for it that's the text that is the user interaction.
The layer of it so on and so forth all the information about every member of the tiles array.
And then later on we have all the sensors Aponte there are 91 and 91 and then 273 and 91.
That's something I expected.
I expected to see something that's going to have the same voice for the first four.
So this one and now one and that one and that's one they have 91 as the voice and those are the 0 1
2 3.
And then the next four of them they will have the same voice simply because they are in the next row
of the items.
So that's kind of giving me the right confidence that I know everything has worked and I have installed
my information improperly and now I can take it out and actually to randomize the times.
Let's do that you know.