WEBVTT 00:00:06.600 --> 00:00:10.360 Now we are going to go through the logic of our fruits game. 00:00:10.650 --> 00:00:17.700 So first of all if we click on the start reset button we are going to check whether we are already playing 00:00:17.730 --> 00:00:19.080 or not. 00:00:19.080 --> 00:00:24.840 So if we are already playing like in this situation then what we're going to do we're going to reload 00:00:24.840 --> 00:00:29.820 the page if we are not playing. 00:00:30.630 --> 00:00:37.740 Then clicking on the start button is going to initiate the game and you need to do a few things. 00:00:37.740 --> 00:00:43.070 So first of all we are going to create a random fruits also. 00:00:43.110 --> 00:00:52.500 We will change the Busson text to reset game and we will show the trials left box. 00:00:52.520 --> 00:00:53.010 OK. 00:00:53.130 --> 00:00:58.620 Once we create the random fruits the fruit is going to start going down. 00:00:58.650 --> 00:01:05.490 So the way it's going to work is we're going to move the fruit down by one step that we can find later 00:01:05.580 --> 00:01:06.920 in the code. 00:01:06.930 --> 00:01:12.780 So for example we can move the fruit down five big cells and that's going to be Eneloop So we move it 00:01:13.080 --> 00:01:21.460 down by one step and then we're going to check is the fruits too low. 00:01:21.510 --> 00:01:29.340 If it's not too low then we are going to keep moving the fruit down and we may check again. 00:01:29.400 --> 00:01:30.800 Is it too low. 00:01:31.020 --> 00:01:34.140 Until the answer to that question is yes. 00:01:34.140 --> 00:01:42.060 So in this situation for example the fruit is too low and once it disappears the answer is going to 00:01:42.060 --> 00:01:43.770 be yes. 00:01:43.770 --> 00:01:48.100 So in that case we're going to check if we have any trials left. 00:01:48.120 --> 00:01:51.820 So in this situation we still have three trials left including this one. 00:01:52.140 --> 00:02:01.380 So if we miss the fruits then we are going to lose one trial and we will need to remove one heart and 00:02:01.410 --> 00:02:10.050 create a new run of fruits and then we are going to go through this again and we will continue like 00:02:10.050 --> 00:02:19.770 this until we have new trials Laughs If we slice the fruits then we will display sound and explode the 00:02:19.770 --> 00:02:23.500 fruits and increase our score by 1. 00:02:23.700 --> 00:02:28.730 So we're going to continue like this until there are no trials left. 00:02:29.310 --> 00:02:35.890 So if we miss this one then it's going to be game over. 00:02:35.940 --> 00:02:45.150 So now we assume the logic of the game and we are ready to translate this into Jay Querrey code is truckster