1
00:00:00,540 --> 00:00:04,530
The objective is we want to be able to build a turtle race,

2
00:00:04,860 --> 00:00:09,860
where we have multiple turtles to run along a line and then see who actually

3
00:00:10,860 --> 00:00:14,400
reaches the finish line first. Now here's a question though.

4
00:00:14,970 --> 00:00:18,660
We know how to build one turtle from the turtle blueprint,

5
00:00:18,930 --> 00:00:23,130
but what if we need more turtles? How do we get hold of them?

6
00:00:23,490 --> 00:00:24,210
Well,

7
00:00:24,210 --> 00:00:29,210
we know that we can use a class or a blueprint to define what a turtle should

8
00:00:31,950 --> 00:00:34,350
appear like and how it should behave.

9
00:00:34,710 --> 00:00:37,830
So what it has and what it can do. Now,

10
00:00:37,830 --> 00:00:42,830
we can then take this class and construct an actual turtle object from it

11
00:00:43,470 --> 00:00:46,980
which is then doing all the drawing and walking around on the screen.

12
00:00:47,430 --> 00:00:51,900
So this is what the code has looked like so far. We have Timmy

13
00:00:51,960 --> 00:00:56,960
which is our turtle object, and turtle coming from the turtle module is the

14
00:00:57,330 --> 00:01:00,060
class which is used to construct this object.

15
00:01:00,420 --> 00:01:05,420
But that's not the end of the story because the whole reason why we can have

16
00:01:06,120 --> 00:01:10,440
these blueprints is so we can make more objects.

17
00:01:10,830 --> 00:01:15,060
So, we're not limited to just one turtle object.

18
00:01:15,090 --> 00:01:19,980
We can create as many as we need in the same way that we have created Timmy.

19
00:01:20,220 --> 00:01:23,910
We create Tommy, Johnny, Jenny, and Benny.

20
00:01:24,840 --> 00:01:28,890
Even though both Timmy and Tommy are turtle objects,

21
00:01:29,130 --> 00:01:32,610
they actually function completely independent of each other.

22
00:01:32,940 --> 00:01:37,920
So in programming, we would say that they are each a separate instance.

23
00:01:38,100 --> 00:01:39,750
So what does that mean? Well,

24
00:01:39,750 --> 00:01:43,830
that means that they're each an example of the turtle object.

25
00:01:44,160 --> 00:01:48,810
So just as you and I are both examples of human objects,

26
00:01:48,930 --> 00:01:52,140
Timmy and Tommy are both examples of turtle objects.

27
00:01:52,650 --> 00:01:55,020
And that means that at any moment in time,

28
00:01:55,140 --> 00:01:59,070
they could have different attributes and they could be doing different things.

29
00:01:59,730 --> 00:02:01,260
So that means, for example,

30
00:02:01,290 --> 00:02:06,290
Timmy could have his color set to green while Tommy could have its color set to

31
00:02:06,960 --> 00:02:09,360
something completely different, like purple.

32
00:02:09,750 --> 00:02:14,750
Now the fact that each of these objects can have different attributes and can be

33
00:02:16,050 --> 00:02:21,050
performing different methods at any one time in programming is known as their

34
00:02:21,660 --> 00:02:22,493
state.

35
00:02:23,070 --> 00:02:28,070
So the state of Timmy's color attribute is green and Tommy's color attribute is

36
00:02:29,370 --> 00:02:31,260
purple. So in this case,

37
00:02:31,290 --> 00:02:35,970
they have different state in terms of their attribute or their appearance.

38
00:02:36,510 --> 00:02:39,780
But they can also have different state in terms of whether

39
00:02:39,780 --> 00:02:42,780
if they are doing something. For example,

40
00:02:42,810 --> 00:02:47,810
Timmy could be asked to move forwards while Tommy is staying completely

41
00:02:48,750 --> 00:02:51,900
stationary. So Timmy is in the middle of a method call

42
00:02:51,930 --> 00:02:56,340
whereas Tommy is not doing anything at all. Now in the next lesson,

43
00:02:56,370 --> 00:02:59,200
we're going to be building out our turtle racing game

44
00:02:59,620 --> 00:03:01,360
and we're going to see this in action.

45
00:03:01,540 --> 00:03:06,540
The idea that you could have separate versions of the same object each with a

46
00:03:07,480 --> 00:03:12,480
different state and acting completely independently from each other in order to

47
00:03:13,600 --> 00:03:17,560
race against each other. So don't worry if this doesn't make sense

48
00:03:17,560 --> 00:03:20,440
a hundred percent just yet. Head over to the next lesson

49
00:03:20,740 --> 00:03:24,190
and we're going to start writing some real code to better understand this

50
00:03:24,190 --> 00:03:24,850
concept.

