WEBVTT
Kind: captions
Language: en

00:00:00.000 --> 00:00:03.646
So far we've been interested in strategies of connect 4,

00:00:03.666 --> 00:00:08.296
but now it's time to apply those strategies to get a structural understanding of the game.

00:00:10.333 --> 00:00:14.435
First of all, you're gonna have to get comfortable imagining the game as a tree.

00:00:15.466 --> 00:00:19.088
For a position of our choice, we draw a node.

00:00:19.133 --> 00:00:25.107
there are some moves that can be made from that position, which we'll represent as connected child nodes.

00:00:25.133 --> 00:00:27.243
Yellow can play in the left column,

00:00:27.266 --> 00:00:30.048
the next column over,

00:00:30.066 --> 00:00:32.944
and so on successively.

00:00:32.966 --> 00:00:38.940
We connect those new nodes to the root with yellow lines, since yellow was the one who played a move here.

00:00:38.966 --> 00:00:45.684
And from those positions, there are even more options that can be made, by Red this time, continuing the graph.

00:00:45.733 --> 00:00:51.611
In other words, every path through this graph represents a particular continuation from the existing board.

00:00:51.633 --> 00:00:55.903
Any set of moves that you could make is in this graph.

00:00:55.933 --> 00:00:59.411
As a result, it gets intractably large really quickly.

00:00:59.433 --> 00:01:03.591
At any position in the opening, there are 7 possible moves to make.

00:01:03.591 --> 00:01:08.189
 So, at a depth of 0, the amount of nodes is 1 (that is, the empty board),

00:01:08.266 --> 00:01:12.560
at a depth of 1, the amount of nodes is 7 (the 7 openings),

00:01:12.599 --> 00:01:16.149
at a depth of 2, the amount of nodes is 49,

00:01:16.200 --> 00:01:19.582
and the progression continues exponentially.

00:01:22.599 --> 00:01:29.221
Now this is just a mess. You can't tell the structure of this graph whatsoever, and we're only 4 moves in.

00:01:29.266 --> 00:01:33.225
In fact, Stefan Edelkamp and Peter Kissmann computed in 2008 that there are a total of 4.

00:01:33.225 --> 00:01:35.022
5 trillion unique positions at any depth.

00:01:35.099 --> 00:01:39.489
We can do some tricks like de-duplicating based on horizontal symmetry,

00:01:39.533 --> 00:01:45.483
but that'll only remove less than half of the nodes, because we're only deleting one node per mirror pair.

00:01:45.533 --> 00:01:50.379
We're gonna need a bit of a paradigm shift if we wanna gain any insight from this tangled mess.

00:01:50.400 --> 00:01:54.478
Instead of growing the graph from the beginning of the game out,

00:01:54.500 --> 00:01:58.938
Let's start with an endgame position to make life a little easier on ourselves.

00:01:58.966 --> 00:02:02.156
This is a particular endgame.

00:02:02.200 --> 00:02:06.038
Let's see what it looks like when we expand out its full tree of positions.

00:02:12.066 --> 00:02:14.944
Now, I wanna focus on the nodes of this graph.

00:02:14.966 --> 00:02:19.836
Let's identify all the terminal states- that is, the nodes which have no children.

00:02:19.866 --> 00:02:23.056
In other words, we're identifying the games which either Red won,

00:02:23.099 --> 00:02:24.705
Yellow won,

00:02:24.733 --> 00:02:28.211
or completely filled without a winner, making it a tie.

00:02:28.233 --> 00:02:33.247
In the case of this endgame, there are some _paths_ that lead to a red victory,

00:02:33.266 --> 00:02:35.712
some _paths_ that lead to a Yellow victory,

00:02:35.733 --> 00:02:39.379
and some _paths_ that lead to the game becoming a tie.

00:02:39.400 --> 00:02:45.950
So, what we might wanna know is, who's favored in the root position? If both players play perfectly, who wins?

00:02:46.000 --> 00:02:51.518
We've constructed this graph, so how can we use it to play optimally from this position?

00:02:51.566 --> 00:02:53.748
We'll have to work our way up to that point.

00:02:53.766 --> 00:02:59.644
Consider this board, which is in the graph. The game hasn't ended yet, but it's about to.

00:02:59.666 --> 00:03:03.240
It's Red's move, with only one choice, which is to win the game.

00:03:03.266 --> 00:03:08.712
So, for all intents and purposes, we might as well color this node red too. Red'll win here.

00:03:08.733 --> 00:03:13.291
We can repeat this line of thinking for all the other moves which force the game into an ending state.

00:03:23.333 --> 00:03:27.051
Awesome! But, now, we're out of obvious nodes to fill in.

00:03:27.099 --> 00:03:29.401
What about this one?

00:03:29.433 --> 00:03:34.615
There's more than one choice, but both of the children have already been colored with a computed game result.

00:03:34.633 --> 00:03:40.343
If we show the edge colors again, we recall that it's yellow to move in this position.

00:03:40.366 --> 00:03:45.260
Looking at the children, one's yellow's win, and one's a tie.

00:03:45.300 --> 00:03:48.538
Well, Yellow will naturally take the win over a tie.

00:03:48.566 --> 00:03:51.852
Therefore, we can color this node as yellow.

00:03:54.900 --> 00:04:01.522
In general, a node's status is the best result of all the children, on behalf of the player whose move it is.

00:04:01.566 --> 00:04:05.020
The algorithm we just used is called Minimax.

00:04:05.066 --> 00:04:10.029
We've worked our way all the way back up to the endgame which we considered in the first place,

00:04:10.029 --> 00:04:11.878
 and it turns out that it was a tie!

00:04:11.966 --> 00:04:13.728
This is called a strong solution.

00:04:13.728 --> 00:04:19.882
 In a strong solution, we examine each possible board, and document what the result should be under optimal play.

00:04:19.966 --> 00:04:24.632
You can think of the strong solution as a dictionary of positions- you can look up a position,

00:04:24.632 --> 00:04:27.090
 and the dictionary tells you who's favored there.

00:04:27.166 --> 00:04:32.996
If we already have a strong solution, we can use it to play optimally. Let's imagine we're playing as Red.

00:04:33.033 --> 00:04:36.463
Let's say Yellow plays in the 7th column.

00:04:36.500 --> 00:04:42.545
Now it's our turn, so we look at all the children of the current node, and choose the one with the best outcome.

00:04:42.566 --> 00:04:46.548
In our case here, one child's a tie, and one shows yellow winning.

00:04:46.566 --> 00:04:50.500
So, we'll choose the tied node, corresponding to a move in the 7th column.

00:04:50.533 --> 00:04:53.507
Yellow responds in the 5th column.

00:04:53.533 --> 00:04:59.699
We examine the new children here and play in the 5th column in response, which is the child node with the best outcome.

00:04:59.733 --> 00:05:02.707
Now yellow plays in column 7.

00:05:02.733 --> 00:05:08.011
In this case the children have the same outcome, so we can just pick one at random.

00:05:08.033 --> 00:05:12.855
Now, yellow only has one choice, which is to conclude the game as a tie.

00:05:12.899 --> 00:05:13.577
By doing this,

00:05:13.577 --> 00:05:19.975
 we, as Red, made the best possible move at each turn, and therefore achieved the optimal result for this starting position.

00:05:20.066 --> 00:05:26.112
Now, instead of doing this selection of optimal branches while playing the game, we can do it upfront all at once.

00:05:26.133 --> 00:05:29.611
We consider each node for which it is Red's turn.

00:05:29.633 --> 00:05:34.719
For those nodes, we'll examine their edges, and from there, select an optimal child node.

00:05:34.766 --> 00:05:37.884
We can now delete all the other children.

00:05:37.933 --> 00:05:41.701
It's important to note that this is no longer a strong solution.

00:05:41.701 --> 00:05:46.305
 There are positions which exist but which are no longer present in our graph.

00:05:46.399 --> 00:05:50.669
We've now chopped off all the variations which we wouldn't choose to play as Red.

00:05:50.699 --> 00:05:51.435
In the graph,

00:05:51.435 --> 00:05:56.883
 this means that all the nodes for which it's Red's turn have only one Red edge coming out-

00:05:56.883 --> 00:05:59.310
 namely the optimal one of our selection.

00:05:59.433 --> 00:06:05.431
But we haven't deleted any of the Yellow edges- you'll still notice that some nodes have multiple yellow children.

00:06:05.466 --> 00:06:10.912
This is because we still need to know how to respond to every possible branch which Yellow can concoct.

00:06:10.933 --> 00:06:14.803
What we've developed here is called a Weak solution (on behalf of Red.

00:06:14.803 --> 00:06:20.409
) It doesn't contain all positions, but it contains enough for us to guarantee Red to play optimally.

00:06:20.500 --> 00:06:25.874
For that reason it shouldn't be a surprise that all the nodes which were yellow-to-win have been removed.

00:06:25.899 --> 00:06:32.834
That would've required a red blunder to get to, and we've removed all branches which contain red blunders.

00:06:32.866 --> 00:06:39.512
So the obvious question is, can we apply Minimax to the opening to determine who should win from the starting position?

00:06:39.533 --> 00:06:45.171
In theory, sure, but even with our modern computers, we can't do this for 4 trillion nodes. It's just too much.

00:06:45.199 --> 00:06:49.811
But by ignoring branches which are suboptimal _while traversing the graph in the first place_,

00:06:49.811 --> 00:06:52.588
 along with a bunch of other tricks, this becomes doable.

00:06:52.666 --> 00:06:55.520
Using these strategies, Connect 4 was solved.

00:06:55.566 --> 00:07:01.108
We know that under optimal play, Red Wins, and only does so by starting with a disk in the center column.

00:07:01.133 --> 00:07:04.779
One space off to either side and it's a tie,

00:07:04.800 --> 00:07:07.581
and anywhere else, it's Yellow to win.

00:07:07.600 --> 00:07:09.062
But why?

00:07:09.100 --> 00:07:12.780
Knowing the game-theoretically-optimal move at any position's great,

00:07:12.780 --> 00:07:16.296
 but it provides absolutely no insight into why this is the case.

00:07:16.366 --> 00:07:17.449
Lemme make an analogy.

00:07:17.449 --> 00:07:20.695
 Imagine a prisoner is forced to memorize a deck of flash cards.

00:07:20.695 --> 00:07:26.464
 On the front of each card is a 2-dimensional coordinate, and the back of the flash card is a hexadecimal number.

00:07:26.600 --> 00:07:34.167
The prison guard forgot to mention that the color codes on the back of the cards document the precise color of the Mona Lisa painting at those two coordinates,

00:07:34.167 --> 00:07:39.291
 and, sadly, our prisoner was too caught up memorizing numbers to realize the structure underlying the data.

00:07:39.366 --> 00:07:42.940
You may call that prisoner the worlds leading expert on the Mona Lisa...

00:07:42.966 --> 00:07:44.279
At least in the sense that,

00:07:44.279 --> 00:07:48.973
 if somebody held a contest to recreate the painting from memory, he'd win it, pixel-by-pixel.

00:07:48.973 --> 00:07:53.112
 As long as the prison guard remembers to tell him that's what the data represents.

00:07:53.233 --> 00:07:54.266
But until that happens,

00:07:54.266 --> 00:07:59.587
 if you were to go up to him and ask 'Is Mona Lisa's left hand on top of her right, or is it the other way around?

00:07:59.587 --> 00:08:00.715
', he would have no idea.

00:08:00.833 --> 00:08:05.559
This analogy sort of illustrates the position we're in with our strong solution for connect 4.

00:08:05.600 --> 00:08:09.537
Just because we know these disparate facts about who wins in what scenario,

00:08:09.537 --> 00:08:13.156
 we can't say we truly understand this system any better than before.

00:08:13.233 --> 00:08:16.495
What's more, this information is effectively incommunicable.

00:08:16.495 --> 00:08:20.861
 Any solution tree is so big that you simply can't be bestowed that information.

00:08:20.933 --> 00:08:24.435
You can't realistically visualize it. You can't realistically memorize it.

00:08:24.466 --> 00:08:30.576
This position is pretty simple- the game is gonna end in 2 moves, and there are no choices to be made.

00:08:30.576 --> 00:08:37.470
 Naturally, our graph is also extremely simple. Let's delete some discs from the board and see how the graphs grow.

00:08:37.566 --> 00:08:43.084
Ok, that's already getting a little bit bigger. I'll keep plucking off pieces and you can watch what happens.

00:08:43.133 --> 00:08:45.809
All the graphs are just gonna keep growing exponentially,

00:08:45.809 --> 00:08:49.825
 with the strong solution being the biggest and the weak solution being the smallest.

00:08:49.899 --> 00:08:54.925
This should give some intuition that even if you claimed to have memorized a _weak_ solution tree of the whole game,

00:08:54.925 --> 00:08:57.720
 merely verifying your memorization would likely take a lifetime.

00:08:57.799 --> 00:09:03.822
So, is there any way to rigorously unite the wisdom and intuition accrued by human experts with the output of this enormous algorithm?

00:09:03.866 --> 00:09:09.720
Well, a strong solution tells us everything that could be known, but weak solutions have a lot more room for creative expression.

00:09:09.766 --> 00:09:15.980
Take a close look at this particular weak solution- notice how it has a very regular structure?

00:09:16.000 --> 00:09:18.983
That's not because all weak solutions are well-structured,

00:09:18.983 --> 00:09:22.908
 it's because I hand-picked this one with the intention for it to be simple.

00:09:23.000 --> 00:09:26.381
We can remove even more pieces and get a better view...

00:09:26.399 --> 00:09:28.632
Y'know how when your computer is storing files,

00:09:28.632 --> 00:09:32.611
 structured information can easily be compressed and the filesize can be decreased?

00:09:32.700 --> 00:09:37.082
Can we immensely reduce the amount of information required to 'know' a weak solution,

00:09:37.082 --> 00:09:39.536
 such that it doesn't require rote memorization?

00:09:39.633 --> 00:09:44.497
In other words, are there any particularly clever ways of representing such weak solutions?

00:09:44.497 --> 00:09:49.469
 We can represent them graph-theoretically, but perhaps they can be expressed by other means?

00:09:49.566 --> 00:09:52.876
I'll give you a hint- Claimeven is the magic bullet here!

00:09:52.899 --> 00:10:00.433
We can use a positional language built on top of the idea of claimeven to concisely express solutions to positions which have a high degree of self-symmetry,

00:10:00.466 --> 00:10:06.056
and in doing so, we can get the full-board graph down from the trillions of nodes to the order of the tens of thousands.

00:10:06.100 --> 00:10:07.286
Or at least, I think so.

00:10:07.286 --> 00:10:13.368
.. I still haven't been able to perform this reduction for the entire graph. Still working on that technical challenge.

00:10:13.466 --> 00:10:19.007
But, what I can tell you for sure is that there's some real human openings which, using reduction by claimeven-

00:10:19.007 --> 00:10:23.036
like strategies, have weak solutions expressable with less than a thousand nodes.

00:10:23.036 --> 00:10:24.044
 Not even a megabyte.

00:10:24.166 --> 00:10:28.100
And they're TOTALLY visualizable, and, if you wanna go there, memorizable too.

00:10:28.133 --> 00:10:29.551
This is a pretty big deal,

00:10:29.551 --> 00:10:36.164
 because it formalizes the player's intuition of discrete variations or openings which are complex and worth learning.

00:10:36.164 --> 00:10:39.671
 The offshooting lines in these graphs map onto them perfectly.

00:10:39.799 --> 00:10:40.981
I'll spoil this one here,

00:10:40.981 --> 00:10:44.330
 but you'll have to stay tuned to see exactly how we accomplish this,

00:10:44.330 --> 00:10:49.057
 as well as what we can learn about systems other than connect 4 from these compressed solutions.

00:10:49.200 --> 00:10:51.022
This has been 2swap.

