1 00:00:01,510 --> 00:00:06,640 So will come back again in this lesson we actually have to do something that is kind of a pro vision 2 00:00:06,640 --> 00:00:08,500 for the upcoming lesson. 3 00:00:08,530 --> 00:00:12,920 So let me go to school and explain why you have to ask for our toil. 4 00:00:12,920 --> 00:00:13,630 Great. 5 00:00:13,660 --> 00:00:19,060 So the next quote I'm going to write this down as comments so we kind of remember what you have to do 6 00:00:19,480 --> 00:00:21,050 sometimes down the track. 7 00:00:21,080 --> 00:00:23,690 We have to be able to randomize the times. 8 00:00:23,920 --> 00:00:30,310 So basically the ties that I have here on the simulator are that all in all there were 0 2 7 9 0 7. 9 00:00:30,370 --> 00:00:35,500 We have to randomize them and in order to randomize it I have a strategy in mind so I'm going to write 10 00:00:35,500 --> 00:00:37,050 that down for you. 11 00:00:37,090 --> 00:00:42,100 You might be able to come up with a different solution but this is going to be my solution for now and 12 00:00:42,100 --> 00:00:45,670 I'm sure there are better ones out there but my solution is this. 13 00:00:45,730 --> 00:00:55,420 Let's remember all the toys let's remember all the sensors if you remember replaced each time in a certain 14 00:00:55,420 --> 00:00:56,330 center. 15 00:00:56,640 --> 00:01:05,490 Then let's go through the tiles and assign a random center. 16 00:01:05,830 --> 00:01:11,320 So here's the strategy I'm going to show it up and we'll show you the simulator as they talk about it. 17 00:01:11,320 --> 00:01:16,330 My strategy is to remember all the title song that maybe in an array. 18 00:01:16,480 --> 00:01:22,680 And then I remember all the centers thing going through all the tiles and randomly find new centers 19 00:01:22,780 --> 00:01:23,800 assigned to them. 20 00:01:23,800 --> 00:01:30,100 So this time that has zero maybe gets this space for this child is number two and then decide which 21 00:01:30,100 --> 00:01:34,150 is six maybe gets this space for zero used to be so on and so forth. 22 00:01:34,150 --> 00:01:40,570 We randomized the entire grade and every time we can read on the why is it just pressing or resets. 23 00:01:40,570 --> 00:01:43,480 Why then are rerunning random function. 24 00:01:43,480 --> 00:01:47,080 Now that is something that we have to do in the next lesson in this lesson. 25 00:01:47,080 --> 00:01:52,900 However we have to do this for remembering the toys and the sensors and to do that I'm actually going 26 00:01:52,900 --> 00:01:55,440 to go ahead and introduce two new variables. 27 00:01:55,490 --> 00:01:56,710 I'm going to say I have a value. 28 00:01:56,780 --> 00:01:59,240 I'm going to call it tiles array. 29 00:01:59,410 --> 00:02:06,190 And this whole area is going to be an array of the objects that we are using and I don't write it right 30 00:02:06,190 --> 00:02:08,350 away I want to show you for what that is. 31 00:02:08,380 --> 00:02:14,290 That object is this one my label because you're using my label to create the tiles. 32 00:02:14,440 --> 00:02:19,680 So it's going to be tiles array an array of my Lieben. 33 00:02:19,900 --> 00:02:25,520 And that is going to be an optional value because we don't have anything in it right at the very beginning. 34 00:02:25,600 --> 00:02:30,430 That's one way of doing it or if you wanted you could actually set it to an empty array at the very 35 00:02:30,430 --> 00:02:31,360 beginning. 36 00:02:31,370 --> 00:02:34,950 Now this is a more swift approach of doing things. 37 00:02:35,110 --> 00:02:40,000 If you're using any other programming language like Objective-C this would be in less of an option for 38 00:02:40,000 --> 00:02:43,680 you but for now it could actually it started with an empty array. 39 00:02:43,750 --> 00:02:49,000 Or am I ever going to make sure that every time that we want to make tiles and this is something that 40 00:02:49,000 --> 00:02:52,610 could happen in our game we might want to make new set of tiles. 41 00:02:52,660 --> 00:02:59,020 I'm going to set these tiles array to be a game and in theory and you could add the semicolon here or 42 00:02:59,020 --> 00:02:59,320 not. 43 00:02:59,320 --> 00:03:05,750 I'm kind of used to some other programming languages notably Java on the C-sharp that I have to other 44 00:03:05,780 --> 00:03:09,360 semicolon but you don't really have to remove it for now. 45 00:03:09,400 --> 00:03:12,690 The other thing we wrote in here was remembering all the. 46 00:03:12,700 --> 00:03:22,090 So I actually our let's call this one censor's array and that is going to be an array of CGV points. 47 00:03:22,240 --> 00:03:25,230 And that's going to be an empty one at the very beginning as well. 48 00:03:25,450 --> 00:03:31,420 And again I will remember every time that they come to making the tiles I'm going to set that to a new 49 00:03:31,420 --> 00:03:32,380 one as well. 50 00:03:32,620 --> 00:03:40,270 So now we have an array for ties an array for centers and they are empty at the very beginning and they 51 00:03:40,270 --> 00:03:42,270 are ready to take on the values. 52 00:03:42,280 --> 00:03:44,800 But nobody's actually adding any values to them. 53 00:03:44,800 --> 00:03:47,060 We are not appending anything to them. 54 00:03:47,170 --> 00:03:49,060 So let's go ahead and do that. 55 00:03:49,090 --> 00:03:55,920 I'm going to come down here where I build new tiles and I'm going to say every time you made a tile 56 00:03:56,100 --> 00:04:02,390 and you made a new center and you gave it the right internal number you showed the right value on them. 57 00:04:02,560 --> 00:04:04,270 Let's go ahead and do this. 58 00:04:04,420 --> 00:04:07,280 The order of it doesn't necessarily matter in here. 59 00:04:07,280 --> 00:04:10,700 I kind of like to put my code in an order that makes sense. 60 00:04:10,780 --> 00:04:16,150 I want the tiles to have the right internal number and they show the right text on them and then I'm 61 00:04:16,150 --> 00:04:20,040 going to say tiles are a dot a pen. 62 00:04:20,360 --> 00:04:23,320 And he's asking for a new object of the type of my labor. 63 00:04:23,320 --> 00:04:25,100 And that is of course trial. 64 00:04:25,420 --> 00:04:31,780 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 65 00:04:31,810 --> 00:04:34,060 I just created this one. 66 00:04:34,180 --> 00:04:35,540 Tyler said. 67 00:04:35,800 --> 00:04:40,970 So we have that now we have both the tiles and the center's return into an array. 68 00:04:41,230 --> 00:04:48,970 Every time Major tiles is being called so we emptied both of them in case they had something in them 69 00:04:49,060 --> 00:04:53,840 and we added all the floor tiles and centers into the two areas in here. 70 00:04:54,040 --> 00:04:59,290 Now in this lesson there isn't really any way for you to test this for that it worked or not except 71 00:04:59,290 --> 00:05:00,540 if you want to print. 72 00:05:00,630 --> 00:05:06,250 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 73 00:05:06,250 --> 00:05:12,870 by now should be populated and they should be written into the Toys R 8 and the centers should be populated. 74 00:05:12,900 --> 00:05:14,780 I returned to the centers array. 75 00:05:14,850 --> 00:05:21,480 I'm going to say Prince and into print I'm going to say I want to print these tiles on earth and then 76 00:05:21,480 --> 00:05:29,820 find what ever you can in the tiles array and then I'm going to copy this and say centers are of course 77 00:05:29,820 --> 00:05:31,360 that's going to be centers. 78 00:05:31,380 --> 00:05:36,360 Ali I want to keep in mind that the tiles are great even though it does pre-NST doesn't really make 79 00:05:36,360 --> 00:05:42,300 much of a sense because it shows us an outlet that eases the air but there isn't really any value that 80 00:05:42,300 --> 00:05:49,220 we can read and understand from it what we could understand are the symptoms shows actual locations. 81 00:05:49,230 --> 00:05:55,350 So once it prints out and the application loads up we get all of these different values that for instance 82 00:05:55,350 --> 00:06:02,240 says we have a tile as our memory puzzle the game my label based classes label. 83 00:06:02,280 --> 00:06:05,990 This is the frame for it that's the text that is the user interaction. 84 00:06:06,000 --> 00:06:11,690 The layer of it so on and so forth all the information about every member of the tiles array. 85 00:06:11,820 --> 00:06:18,890 And then later on we have all the sensors Aponte there are 91 and 91 and then 273 and 91. 86 00:06:18,900 --> 00:06:20,370 That's something I expected. 87 00:06:20,370 --> 00:06:25,320 I expected to see something that's going to have the same voice for the first four. 88 00:06:25,320 --> 00:06:32,830 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 89 00:06:32,830 --> 00:06:33,640 2 3. 90 00:06:33,840 --> 00:06:40,040 And then the next four of them they will have the same voice simply because they are in the next row 91 00:06:40,050 --> 00:06:41,280 of the items. 92 00:06:41,280 --> 00:06:45,990 So that's kind of giving me the right confidence that I know everything has worked and I have installed 93 00:06:45,990 --> 00:06:51,300 my information improperly and now I can take it out and actually to randomize the times. 94 00:06:51,450 --> 00:06:52,890 Let's do that you know.