WEBVTT

0
00:00.390 --> 00:03.480
All right. Onwards to the next turtle challenge.

1
00:03.990 --> 00:06.960
So this one is going to be a little bit more intensive,

2
00:06.990 --> 00:08.880
but still a bit of a warmup.

3
00:08.910 --> 00:13.910
So we're just going to go for a light jog and we're going to draw a dashed line.

4
00:15.150 --> 00:18.720
You're going to get your turtle to draw a line like this

5
00:19.050 --> 00:24.000
where it's going to draw a line for 10 paces and then a gap of 10 paces,

6
00:24.360 --> 00:26.400
and then a solid line for 10 paces again

7
00:26.400 --> 00:30.150
and it's going to repeat this until it does this 50 times.

8
00:30.720 --> 00:33.270
The actual length of the line doesn't really matter,

9
00:33.630 --> 00:37.260
the actual length of each of the sections doesn't really matter.

10
00:37.260 --> 00:41.580
What's really important is you're able to get this alternating draw-

11
00:41.580 --> 00:44.850
no-draw thing going on. To complete this challenge

12
00:44.880 --> 00:49.880
you're going to need to look through the documentation and maybe also use the

13
00:50.760 --> 00:55.230
help of Google or Stack Overflow and figure out how you can get this behavior to

14
00:55.230 --> 01:00.090
happen. Have a think about it and pause the video and complete the challenge.

15
01:03.000 --> 01:06.330
All right. So if we look through the table of contents here,

16
01:06.720 --> 01:11.550
we can see that the thing that controls the pen is in this section.

17
01:11.670 --> 01:15.660
We can control it's drawing, color, filling and more.

18
01:16.080 --> 01:18.960
Now if we look at the drawing control you can see

19
01:18.960 --> 01:23.790
we can get it to pen down and pen up. When we pull the pen down,

20
01:23.970 --> 01:27.450
that means the pen is on the paper and it's going to make a mark.

21
01:27.840 --> 01:32.370
But when the pen is pulled up, then there's going to be no drawing happening

22
01:32.610 --> 01:34.740
when our turtle is moving.

23
01:35.700 --> 01:39.270
That means we can write some sort of loop, right?

24
01:39.270 --> 01:44.070
Where we get our turtle to move forwards by 10 paces

25
01:44.640 --> 01:48.720
and then we can get this to pull the pen up.

26
01:49.620 --> 01:54.300
And what this is going to do is allow us to move forwards without drawing.

27
01:54.720 --> 01:59.220
So now, while the pen is held up we're going to go forwards. Once more

28
01:59.310 --> 02:03.420
another 10 paces this is going to draw the blank. And then finally,

29
02:03.420 --> 02:06.000
we're gonna go ahead and put the pen down again.

30
02:07.890 --> 02:12.890
So now, all we need is for these four steps to repeat 15 times so we can write a

31
02:15.780 --> 02:20.280
for loop and then create a range that goes from 0 to 15.

32
02:20.730 --> 02:25.730
And then once we indent this block inside the for loop and run our code,

33
02:26.430 --> 02:29.340
then you can see it draw our dashed line.

34
02:30.030 --> 02:31.620
Did you manage to get this solution?

35
02:31.980 --> 02:36.420
Did you manage to find the relevant part of the documentation to be able to pull

36
02:36.420 --> 02:41.420
the pen up and put the pen down, or did you simply change your code so that it

37
02:41.790 --> 02:45.840
drew black and then it drew white? All of these solutions would work,

38
02:45.930 --> 02:50.930
but what I really wanted you to do is to dig through the documentation and find

39
02:51.540 --> 02:54.360
the parts which will help you to achieve your goals.

40
02:55.710 --> 02:57.000
Head over to the next lesson

41
02:57.120 --> 03:00.180
and I've got another slightly harder challenge for you.