1
00:00:05,120 --> 00:00:09,240
Hi, welcome to this last and
final video of this week.

2
00:00:09,240 --> 00:00:10,860
We're going to be
wrapping up the project

3
00:00:10,860 --> 00:00:13,220
of the way function
collapse algorithm.

4
00:00:13,220 --> 00:00:14,860
Let's discuss a little bit what

5
00:00:14,860 --> 00:00:17,920
this algorithm is, what
it could be used for.

6
00:00:17,920 --> 00:00:21,000
The way function collapse
algorithm can be found

7
00:00:21,000 --> 00:00:24,235
in numerous design applications.

8
00:00:24,235 --> 00:00:26,140
We're working with
an algorithm that is

9
00:00:26,140 --> 00:00:29,695
a procedural design or a
generative design algorithm.

10
00:00:29,695 --> 00:00:33,960
You can see it in the
design of levels in games.

11
00:00:33,960 --> 00:00:35,860
You can see an
architectural layout.

12
00:00:35,860 --> 00:00:38,660
It's certainly useful for
graphic design and art,

13
00:00:38,660 --> 00:00:41,130
anything that has to do
with tile-based artwork.

14
00:00:41,130 --> 00:00:44,200
It's certainly very powerful
and it has many variations.

15
00:00:44,200 --> 00:00:46,180
I invite you to
start looking into

16
00:00:46,180 --> 00:00:49,350
the different variations that
you could achieve with it.

17
00:00:49,350 --> 00:00:52,540
You could actually work
with hexagonal patterns.

18
00:00:52,540 --> 00:00:54,795
Certainly if you're working
in a 3D environment,

19
00:00:54,795 --> 00:00:56,760
there's great games and

20
00:00:56,760 --> 00:00:59,100
projects in architecture
that have been using

21
00:00:59,100 --> 00:01:02,680
this algorithm in 3D to really

22
00:01:02,680 --> 00:01:04,540
start operating more in

23
00:01:04,540 --> 00:01:06,100
a voxel space and how do you

24
00:01:06,100 --> 00:01:08,185
achieve the compatibility
between tiles,

25
00:01:08,185 --> 00:01:10,030
but it uses similar principles.

26
00:01:10,030 --> 00:01:12,745
The principles of compatibility

27
00:01:12,745 --> 00:01:14,690
and how that is
demonstrated either

28
00:01:14,690 --> 00:01:17,650
graphically in a pixel tile

29
00:01:17,650 --> 00:01:21,915
or in the geometry of 3D tile.

30
00:01:21,915 --> 00:01:25,430
I would like to do some final
clean up modifications,

31
00:01:25,430 --> 00:01:27,500
try to make the algorithm a
little bit more expressive,

32
00:01:27,500 --> 00:01:29,990
see it run in its
full form so that

33
00:01:29,990 --> 00:01:32,690
we conclude this course

34
00:01:32,690 --> 00:01:34,450
and this week with

35
00:01:34,450 --> 00:01:36,310
this beautiful
algorithm executing

36
00:01:36,310 --> 00:01:38,515
in full form or
in full capacity.

37
00:01:38,515 --> 00:01:39,690
Let's just jump back into

38
00:01:39,690 --> 00:01:41,675
the code and do a
little bit of clean up.

39
00:01:41,675 --> 00:01:43,910
Just to conclude,
we're working and

40
00:01:43,910 --> 00:01:46,730
finishing on the same project.

41
00:01:46,730 --> 00:01:49,490
The first thing I
would like to do,

42
00:01:49,490 --> 00:01:52,130
it's increasing the resolution.

43
00:01:52,130 --> 00:01:53,870
Many times I invite

44
00:01:53,870 --> 00:01:56,610
students to work with a
very small resolution.

45
00:01:56,610 --> 00:01:58,755
We can see things very clearly.

46
00:01:58,755 --> 00:02:01,495
But once you have
things working,

47
00:02:01,495 --> 00:02:04,410
it's interesting to
see how we could

48
00:02:04,410 --> 00:02:08,130
actually increase
the resolution of

49
00:02:08,130 --> 00:02:11,420
an algorithm and see
the computational speed

50
00:02:11,420 --> 00:02:13,470
and the execution of everything

51
00:02:13,470 --> 00:02:15,950
happening at a larger scale.

52
00:02:15,950 --> 00:02:19,850
I'm going to basically
bypass our system.

53
00:02:19,850 --> 00:02:22,290
That requires us to
press a button for

54
00:02:22,290 --> 00:02:25,620
updating just by running the

55
00:02:25,620 --> 00:02:29,970
my_environment.run
function without this

56
00:02:29,970 --> 00:02:31,130
if statement so we can

57
00:02:31,130 --> 00:02:33,950
actually see it
execute in real time.

58
00:02:33,950 --> 00:02:37,110
The fact that we have
a larger environment

59
00:02:37,110 --> 00:02:40,670
means that the cell size
is going to be smaller.

60
00:02:40,670 --> 00:02:42,790
The thing that we
actually never did,

61
00:02:42,790 --> 00:02:44,530
actually if you go here to

62
00:02:44,530 --> 00:02:46,770
the display entropy of the tile,

63
00:02:46,770 --> 00:02:49,090
you probably saw in our
slides that we were

64
00:02:49,090 --> 00:02:51,990
changing the color of
the text and changing

65
00:02:51,990 --> 00:02:59,115
the size of the text dynamically
based on some criteria.

66
00:02:59,115 --> 00:03:00,710
Let's do that so
that we can give it

67
00:03:00,710 --> 00:03:03,295
a bit more expression
to the algorithm.

68
00:03:03,295 --> 00:03:07,230
I'm going to call
this text not green.

69
00:03:07,230 --> 00:03:09,530
It's like a path name,

70
00:03:09,530 --> 00:03:11,545
but you'll see what
I mean by that.

71
00:03:11,545 --> 00:03:14,480
I want to map. I love
the map function.

72
00:03:14,480 --> 00:03:16,390
It's a very quick way of

73
00:03:16,390 --> 00:03:19,400
converting a variable,
something like entropy.

74
00:03:22,310 --> 00:03:24,720
We know that the entropy goes

75
00:03:24,720 --> 00:03:27,970
between one and 16
and we're going

76
00:03:27,970 --> 00:03:32,470
to convert that to a value
between zero and 255.

77
00:03:33,590 --> 00:03:35,950
I say not green because we're

78
00:03:35,950 --> 00:03:37,390
going to use it for the red and

79
00:03:37,390 --> 00:03:41,000
the blue channel of our fill.

80
00:03:41,000 --> 00:03:46,920
The fill here, we're going
to say text no green.

81
00:03:46,920 --> 00:03:49,810
RG, this is going to
be the green value.

82
00:03:49,810 --> 00:03:53,100
That's going to remain at 255,

83
00:03:53,100 --> 00:03:54,720
so it's intensely green.

84
00:03:54,720 --> 00:03:57,430
When it's a small number,

85
00:03:58,790 --> 00:04:00,880
then we can actually just

86
00:04:00,880 --> 00:04:03,100
affect the red and
the blue channel.

87
00:04:03,100 --> 00:04:06,120
That would change the
color of the text,

88
00:04:06,120 --> 00:04:12,940
but we want to also do some
dynamic size of the text.

89
00:04:12,940 --> 00:04:18,430
Let's just map also the entropy.

90
00:04:21,410 --> 00:04:26,350
That goes also from 1-16.

91
00:04:26,490 --> 00:04:28,850
Here we're going to
invert the number.

92
00:04:28,850 --> 00:04:31,490
We're going to say if the
number is closer to one,

93
00:04:31,490 --> 00:04:32,570
it's going to be bigger, so it's

94
00:04:32,570 --> 00:04:34,050
going to have more expression.

95
00:04:34,050 --> 00:04:37,465
If the number is large,
it's going to be smaller.

96
00:04:37,465 --> 00:04:39,735
Here, you have to be careful.

97
00:04:39,735 --> 00:04:41,630
As you're working
with a tile set

98
00:04:41,630 --> 00:04:43,150
that is bigger or smaller,

99
00:04:43,150 --> 00:04:46,410
this number should
never go below zero.

100
00:04:46,660 --> 00:04:49,460
You might want to do

101
00:04:49,460 --> 00:04:53,750
a revision saying
if it's below zero,

102
00:04:53,750 --> 00:04:55,130
keep it at maybe one.

103
00:04:55,130 --> 00:04:56,590
Or if it's close to one,

104
00:04:56,590 --> 00:04:58,585
give it a minimum number.

105
00:04:58,585 --> 00:05:00,350
But in this case,

106
00:05:00,350 --> 00:05:04,505
we're going to remap the
entropy of one to a size of 20,

107
00:05:04,505 --> 00:05:06,790
entropy of 16 to
a size of eight.

108
00:05:06,790 --> 00:05:09,915
That's the domains we're
going to be working.

109
00:05:09,915 --> 00:05:12,930
This text size,

110
00:05:12,930 --> 00:05:15,285
we can use that

111
00:05:15,285 --> 00:05:19,100
to basically alter and

112
00:05:19,100 --> 00:05:21,015
we're going to comment
out this line here.

113
00:05:21,015 --> 00:05:22,980
That says text size 16,

114
00:05:22,980 --> 00:05:24,310
so now the text size is going

115
00:05:24,310 --> 00:05:26,345
to be defined by
this new variable.

116
00:05:26,345 --> 00:05:30,430
That was an arbitrary
number that we were using.

117
00:05:30,430 --> 00:05:31,590
Now, this is actually using

118
00:05:31,590 --> 00:05:34,965
a mapping function.
I think that's it.

119
00:05:34,965 --> 00:05:37,570
Let's see what we have
and we could evaluate if

120
00:05:37,570 --> 00:05:38,930
there's any errors or

121
00:05:38,930 --> 00:05:41,255
things that we would
like to change.

122
00:05:41,255 --> 00:05:44,910
There we have it. We
have much smaller cells.

123
00:05:44,910 --> 00:05:47,910
They're actually
executing automatically

124
00:05:47,910 --> 00:05:49,590
without the pressing
of a button.

125
00:05:49,590 --> 00:05:52,765
You can see how the
cells are actually nice,

126
00:05:52,765 --> 00:05:58,170
bright green color
when they are with

127
00:05:58,170 --> 00:06:02,655
a lower number and

128
00:06:02,655 --> 00:06:04,800
this smaller white number of

129
00:06:04,800 --> 00:06:07,815
16 when they're going to
have multiple options.

130
00:06:07,815 --> 00:06:10,410
We can see the
algorithm executing and

131
00:06:10,410 --> 00:06:13,555
resolving the entire fill.

132
00:06:13,555 --> 00:06:17,290
This is a conclusion
of this week.

133
00:06:17,290 --> 00:06:19,050
This is the full form of

134
00:06:19,050 --> 00:06:21,410
the algorithm the way
function collapse algorithm.

135
00:06:21,410 --> 00:06:23,030
We're going to be
concluding here.

136
00:06:23,030 --> 00:06:25,490
In the next final video
for the whole course,

137
00:06:25,490 --> 00:06:27,290
we're going to be revisiting and

138
00:06:27,290 --> 00:06:29,630
understanding what
we have covered

139
00:06:29,630 --> 00:06:31,850
throughout this
specialization and

140
00:06:31,850 --> 00:06:35,150
discussing where you can go
next. I'll see you then.