1
00:00:05,760 --> 00:00:08,440
Hi, welcome to this new lesson.

2
00:00:08,440 --> 00:00:10,320
We're finally at Week 5,

3
00:00:10,320 --> 00:00:12,220
which is going to
be our final week,

4
00:00:12,220 --> 00:00:16,360
and I'm excited to cover with
you object interactions.

5
00:00:16,360 --> 00:00:19,100
We have covered already how

6
00:00:19,100 --> 00:00:22,940
to create data structures such
as lists and dictionaries.

7
00:00:22,940 --> 00:00:26,860
We've also covered
how to use vectors

8
00:00:26,860 --> 00:00:29,020
as data structures that

9
00:00:29,020 --> 00:00:33,235
contain information about
direction and magnitude.

10
00:00:33,235 --> 00:00:37,890
We also been learning how
to operate with grids,

11
00:00:37,890 --> 00:00:39,510
and finally, with objects.

12
00:00:39,510 --> 00:00:42,790
Objects are what we
define as classes,

13
00:00:42,790 --> 00:00:44,430
classes that in a way,

14
00:00:44,430 --> 00:00:48,220
allow us to construct
objects and use those to

15
00:00:48,220 --> 00:00:51,190
modularly construct a series

16
00:00:51,190 --> 00:00:53,560
of functionality that
is self contained.

17
00:00:53,560 --> 00:00:55,350
In this final week,

18
00:00:55,350 --> 00:00:56,710
what we really want to do is

19
00:00:56,710 --> 00:00:58,230
start putting these
things together.

20
00:00:58,230 --> 00:01:00,170
We are going to be using

21
00:01:00,170 --> 00:01:04,010
the framework of object
interactions to really describe

22
00:01:04,010 --> 00:01:09,465
how objects within an object
oriented paradigm behave

23
00:01:09,465 --> 00:01:11,180
and relate to one
another and how

24
00:01:11,180 --> 00:01:13,180
do we actually make them
speak to one another?

25
00:01:13,180 --> 00:01:15,020
Especially, they
will speak through

26
00:01:15,020 --> 00:01:17,840
the data structures that
we have been learning.

27
00:01:17,840 --> 00:01:20,640
We will see how they
operate and can

28
00:01:20,640 --> 00:01:24,170
render themselves visible to
one another through lists,

29
00:01:24,170 --> 00:01:27,240
through grids, through
distance checks,

30
00:01:27,240 --> 00:01:30,160
and other different
forms of evaluation.

31
00:01:30,160 --> 00:01:31,940
Let's look at some of those.

32
00:01:31,940 --> 00:01:34,200
What we're really talking
about is how does

33
00:01:34,200 --> 00:01:39,095
one object interact or send
a message to another object?

34
00:01:39,095 --> 00:01:42,690
That object, maybe you
want to just change

35
00:01:42,690 --> 00:01:46,320
or ask for a coordinate
or change your color,

36
00:01:46,320 --> 00:01:47,910
any interaction that we

37
00:01:47,910 --> 00:01:49,595
might want to have
between objects.

38
00:01:49,595 --> 00:01:52,710
This is a task that we
haven't really covered yet.

39
00:01:52,710 --> 00:01:54,350
We know how to construct objects

40
00:01:54,350 --> 00:01:56,590
that are autonomous
and self contained,

41
00:01:56,590 --> 00:01:58,010
but we haven't really
started seeing how

42
00:01:58,010 --> 00:01:59,960
they interact with one another.

43
00:01:59,960 --> 00:02:03,140
This is the foundation
of systems, in a way.

44
00:02:03,140 --> 00:02:04,420
If you really start
thinking about

45
00:02:04,420 --> 00:02:06,340
how systems are constructed,

46
00:02:06,340 --> 00:02:09,660
it has to do with a series
of autonomous entities

47
00:02:09,660 --> 00:02:14,290
that send messages and
information between one another.

48
00:02:14,570 --> 00:02:17,160
As we can see here,

49
00:02:17,160 --> 00:02:18,760
we can actually understand

50
00:02:18,760 --> 00:02:21,380
the messaging behavior
between two entities,

51
00:02:21,380 --> 00:02:23,815
but also as this grows,

52
00:02:23,815 --> 00:02:26,420
as we have a system that
has multiple entities,

53
00:02:26,420 --> 00:02:30,300
we can really start seeing
that a more complex system

54
00:02:30,300 --> 00:02:32,460
emerges and something
that perhaps

55
00:02:32,460 --> 00:02:34,880
its behavior might be more
difficult to predict.

56
00:02:34,880 --> 00:02:37,365
Therefore, we will
be simulating.

57
00:02:37,365 --> 00:02:40,020
It would only be possible
for us to understand

58
00:02:40,020 --> 00:02:43,925
the behavior of a system
through the simulation,

59
00:02:43,925 --> 00:02:47,820
executing our code and

60
00:02:47,820 --> 00:02:50,060
observing and maybe perhaps

61
00:02:50,060 --> 00:02:53,515
storing some data of how
the system is behaving.

62
00:02:53,515 --> 00:02:57,430
Let's look at an
example of how objects

63
00:02:57,430 --> 00:03:01,455
might interact with each
other in relation to a grid.

64
00:03:01,455 --> 00:03:03,510
Here, we actually
have three entities.

65
00:03:03,510 --> 00:03:05,650
Let's call them some
random walkers as

66
00:03:05,650 --> 00:03:08,870
we've been seeing
throughout this course.

67
00:03:09,320 --> 00:03:11,610
They're an autonomous entity,

68
00:03:11,610 --> 00:03:14,030
but they're at the same
time relying on a grid,

69
00:03:14,030 --> 00:03:16,230
which could be, as we
will see throughout

70
00:03:16,230 --> 00:03:18,855
this week, also an object.

71
00:03:18,855 --> 00:03:21,195
We have the object of the grid,

72
00:03:21,195 --> 00:03:23,670
we could have the
object of a cell.

73
00:03:23,670 --> 00:03:27,050
A grid in an object
oriented paradigm,

74
00:03:27,050 --> 00:03:30,630
could be thought as a
collection of cells.

75
00:03:30,630 --> 00:03:33,010
But at the same time we
have this random walker,

76
00:03:33,010 --> 00:03:35,935
which has a position
in this grid.

77
00:03:35,935 --> 00:03:39,270
These entities could
actually talk to each other

78
00:03:39,270 --> 00:03:42,550
not only through maybe
direct proximity,

79
00:03:42,550 --> 00:03:45,070
but also by their relationality.

80
00:03:45,070 --> 00:03:47,410
If you think of
the game of chess,

81
00:03:47,410 --> 00:03:49,510
the relationship is established

82
00:03:49,510 --> 00:03:51,670
by the rules of each
one of the pieces,

83
00:03:51,670 --> 00:03:53,330
but at the same time it's

84
00:03:53,330 --> 00:03:57,420
relational position
to one another.

85
00:03:57,420 --> 00:04:00,615
Many times, we do not have
a grid in the background.

86
00:04:00,615 --> 00:04:03,090
We do not have a system like

87
00:04:03,090 --> 00:04:04,330
a grid that would allow us to

88
00:04:04,330 --> 00:04:06,330
keep track of where things are,

89
00:04:06,330 --> 00:04:07,670
and that's totally fine.

90
00:04:07,670 --> 00:04:11,320
We could actually have
entities floating in space.

91
00:04:11,450 --> 00:04:15,230
We can use different criteria
such as distance and

92
00:04:15,230 --> 00:04:18,890
orientation to select what

93
00:04:18,890 --> 00:04:22,490
are the perhaps certain units

94
00:04:22,490 --> 00:04:27,405
that might be capable
to be interacted with.

95
00:04:27,405 --> 00:04:28,970
If we want to let's say push

96
00:04:28,970 --> 00:04:30,810
away from a unit
that is too close,

97
00:04:30,810 --> 00:04:33,650
that's a unit that we need
to calculate a distance to.

98
00:04:33,650 --> 00:04:36,150
This is a series of calculations

99
00:04:36,150 --> 00:04:39,180
that might be
computationally expensive if

100
00:04:39,180 --> 00:04:43,160
we actually start relying
a lot in loops to

101
00:04:43,160 --> 00:04:49,000
iterate over the entire
list of objects.

102
00:04:49,000 --> 00:04:50,700
But they can yield

103
00:04:50,700 --> 00:04:52,460
exactly the objects
that we're looking for.

104
00:04:52,460 --> 00:04:54,240
Is this object in the
right orientation?

105
00:04:54,240 --> 00:04:55,980
Is this object close to me?

106
00:04:55,980 --> 00:04:59,140
Or there could be a series
of criterias that are

107
00:04:59,140 --> 00:05:01,440
met in order to achieve what

108
00:05:01,440 --> 00:05:03,550
would be an interaction
between objects.

109
00:05:03,550 --> 00:05:05,280
We're going to be
covering many of

110
00:05:05,280 --> 00:05:07,400
these different
forms of interaction

111
00:05:07,400 --> 00:05:09,780
throughout this week one by one,

112
00:05:09,780 --> 00:05:11,340
and so I'll take you through

113
00:05:11,340 --> 00:05:14,120
them in the next
lesson. See you then.