WEBVTT
Kind: captions
Language: en

00:00:00.999 --> 00:00:05.625
Let's start with a simple question. Whose turn is it? It's important that we know.

00:00:05.666 --> 00:00:08.777
If it's red's turn, then Red will have to expose this threat.

00:00:09.299 --> 00:00:11.365
Then, Yellow will take it and win.

00:00:14.399 --> 00:00:17.354
If it's Yellow's turn, then Yellow will have to expose it.

00:00:18.400 --> 00:00:21.171
Then Red claims the threat and wins.

00:00:22.200 --> 00:00:25.781
Whomever's turn it is, they are done for.

00:00:25.800 --> 00:00:27.695
This is the notion of the Zugzwang.

00:00:27.695 --> 00:00:30.758
 To be in the Zugzwang is to be forced to play on the X,

00:00:30.758 --> 00:00:33.042
 to permit the opponent to claim a threat.

00:00:33.233 --> 00:00:38.172
You don't want to be in the Zugzwang. It means giving something away to your opponent.

00:00:38.200 --> 00:00:41.963
For this reason, it's imperative that we know whose turn it is.

00:00:42.000 --> 00:00:45.659
Like last time, let's follow the convention of Red playing first.

00:00:45.699 --> 00:00:48.388
Since after every red move there is a yellow move,

00:00:48.388 --> 00:00:52.992
 that means, if the amount of pieces that have been played is even, it is Red's turn.

00:00:54.066 --> 00:00:58.431
Of course, that means, if the number of disks played is odd, it's Yellow's turn.

00:01:00.466 --> 00:01:04.178
Let's go back to our game then. The amount of pieces played was odd.

00:01:04.199 --> 00:01:06.056
That means it's Yellow's turn.

00:01:06.099 --> 00:01:09.785
Yellow is in the Zugzwang. Yellow is forced to play the X.

00:01:10.833 --> 00:01:13.735
Then Red gets to claim the threat and win.

00:01:14.766 --> 00:01:17.276
Let's wind back time a few moves.

00:01:17.299 --> 00:01:19.181
This game isn't fully developed yet.

00:01:19.181 --> 00:01:24.226
 There are still a number of moves to play before either player is forced to expose the threat.

00:01:24.299 --> 00:01:28.377
However, playing in the left two columns doesn't make any new threats.

00:01:29.399 --> 00:01:32.502
We are inevitably going to arrive at the same position,

00:01:32.502 --> 00:01:35.203
 regardless of what pieces go where on the left.

00:01:37.299 --> 00:01:41.761
In this sense, because the structure of the threats is complete, we call this the endgame.

00:01:41.761 --> 00:01:42.513
 In the endgame,

00:01:42.513 --> 00:01:44.868
 since all of the threats are already developed,

00:01:44.868 --> 00:01:46.974
 we can take some shortcuts and read ahead.

00:01:48.166 --> 00:01:51.800
For example, we already know that all of these spots are going to fill up.

00:01:51.800 --> 00:01:53.343
 We just don't know exactly how.

00:01:53.433 --> 00:01:54.368
What this means is,

00:01:54.368 --> 00:01:57.015
 we can look at the evenness or oddness like before,

00:01:57.015 --> 00:02:00.388
 but instead of only considering the disks which have been played,

00:02:00.533 --> 00:02:05.603
instead we will consider all of the disks that have been played, and will be played.

00:02:05.633 --> 00:02:07.934
I call this area the dead space.

00:02:07.966 --> 00:02:13.622
In the same way that the evenness or oddness of the amount of pieces reveals whose turn it is,

00:02:13.622 --> 00:02:20.493
 the evenness or oddness of the amount of dead space reveals whose turn it will be when a threat must be revealed.

00:02:20.493 --> 00:02:23.113
 That is, it reveals who is in the Zugzwang.

00:02:23.113 --> 00:02:26.888
 In our case, the dead space is odd. Yellow is in the Zugzwang.

00:02:27.066 --> 00:02:28.584
The dead space will be filled,

00:02:29.633 --> 00:02:31.751
Yellow will uncover the threat,

00:02:32.799 --> 00:02:34.787
and Red claims it.

00:02:34.833 --> 00:02:37.009
Now that we have this useful abstraction,

00:02:37.009 --> 00:02:40.924
 we don't actually need to worry about the pieces which have been played.

00:02:41.999 --> 00:02:43.621
We know where the dead space is,

00:02:43.621 --> 00:02:45.922
 and we also know that we are in the endgame,

00:02:45.922 --> 00:02:49.321
 so the threats can't change, and thus neither can the dead space.

00:02:49.466 --> 00:02:51.637
We can remove all the pieces,

00:02:52.666 --> 00:02:54.392
separate the columns,

00:02:54.433 --> 00:02:57.256
and perform the computation just the same.

00:02:57.299 --> 00:03:00.750
We identify the dead space, and determine that it is odd,

00:03:01.799 --> 00:03:05.119
and know that Yellow will expose the threat to Red.

00:03:08.199 --> 00:03:12.180
Ok, so we know, in general, the player who is in Zugzwang is Red-

00:03:12.180 --> 00:03:18.888
 that is, player 1, if the amount of dead space is even, or Yellow, AKA player 2, in the case that it is odd.

00:03:18.966 --> 00:03:24.226
As a corollary, This means that any row which has no threat at all can simply be ignored.

00:03:24.226 --> 00:03:27.755
 6 pieces will be played in that column with no consequence,

00:03:27.755 --> 00:03:32.478
 so it doesn't change the evenness or oddness of the total amount of dead space.

00:03:32.599 --> 00:03:33.181
Knowing this,

00:03:33.181 --> 00:03:37.306
 it is obvious why our parity rules from last time work when there is a single threat.

00:03:38.399 --> 00:03:40.129
When the threat is odd- that is,

00:03:40.129 --> 00:03:44.807
 it's on an odd row, such as this example here, there is an odd amount of dead space.

00:03:44.807 --> 00:03:46.870
 That means Yellow is in the Zugzwang.

00:03:49.999 --> 00:03:51.844
If the threat had been on an even row,

00:03:51.844 --> 00:03:54.386
 there would have been an even amount of dead space,

00:03:54.386 --> 00:03:56.380
 meaning Red would have been in Zugzwang.

00:03:58.499 --> 00:04:03.413
And, to reiterate, adding an empty column won't change this result.

00:04:04.433 --> 00:04:10.195
Both players will just climb up the column and it will be red's turn in Zugzwang once again.

00:04:10.195 --> 00:04:13.998
 Adding an even amount of dead space doesn't change anything.

00:04:15.066 --> 00:04:18.037
But as promised, it's time to generalize.

00:04:18.037 --> 00:04:21.672
 There can be multiple rows which contain threats,

00:04:21.672 --> 00:04:24.790
 and each row can contain multiple threats.

00:04:24.966 --> 00:04:29.670
First, let's just set up a complex array of threats and see what happens.

00:04:29.699 --> 00:04:32.049
Now, there is some sleight of hand going on.

00:04:32.049 --> 00:04:36.199
 These threats couldn't really exist simultaneously on a standard board size,

00:04:36.199 --> 00:04:37.786
 there's just not enough room.

00:04:37.786 --> 00:04:42.317
 But you can imagine we are playing on a much wider board, still with a height of 6.

00:04:42.317 --> 00:04:44.940
 Don't worry though, it should work out the same.

00:04:45.166 --> 00:04:49.130
The players begin by filling up the dead space, and there's an odd amount.

00:04:49.130 --> 00:04:50.761
 So, Yellow is in the Zugzwang.

00:04:50.833 --> 00:04:54.675
In other words, it's Yellow who gets to choose which threat to expose.

00:04:54.700 --> 00:05:01.102
Of course, Yellow wouldn't expose a red threat, since Red would claim it, instantly winning the game.

00:05:03.133 --> 00:05:07.942
That means Yellow will have to expose a Yellow threat, leaving us with these 3 options.

00:05:08.966 --> 00:05:11.868
Let's say Yellow picks this one.

00:05:11.900 --> 00:05:13.478
Yellow exposes the threat,

00:05:13.478 --> 00:05:14.869
 Red blocks the threat,

00:05:14.869 --> 00:05:19.456
 and the players fill in the newly discovered dead space above the threat.

00:05:19.600 --> 00:05:22.287
But now, Yellow is once again in the Zugzwang!

00:05:22.287 --> 00:05:27.474
 So, this didn't accomplish anything other than removing a Yellow threat from the board.

00:05:27.474 --> 00:05:29.507
 Perhaps there was a better option?

00:05:30.633 --> 00:05:32.202
What about this threat?

00:05:32.233 --> 00:05:36.127
Yellow exposes the threat, Red blocks the threat,

00:05:36.166 --> 00:05:39.367
but this time there is no dead space above the threat.

00:05:39.367 --> 00:05:43.772
 Once again, Yellow is in the Zugzwang. That leaves only one other option.

00:05:44.866 --> 00:05:47.794
What if Yellow chooses to expose the leftmost threat?

00:05:47.833 --> 00:05:48.880
Yellow exposes it,

00:05:48.880 --> 00:05:53.584
 Red blocks it, and then, Yellow plays the single dead space above the threat.

00:05:53.666 --> 00:05:55.941
Now, Red is in the Zugzwang!

00:05:55.966 --> 00:05:58.502
But... what actually just happened there?

00:05:59.533 --> 00:06:06.458
In reality, we are not interested in the threat alone, rather the set of moves that get played in association with that threat.

00:06:06.500 --> 00:06:08.147
This includes the threat itself,

00:06:08.147 --> 00:06:10.431
 the spot below it which exposes the threat,

00:06:10.431 --> 00:06:15.048
 and all of the dead space which will be played immediately after the threat is blocked.

00:06:15.166 --> 00:06:19.644
Now it becomes clear why the leftmost threat gets Yellow out of the Zugzwang.

00:06:19.644 --> 00:06:23.593
 It is the only threat which is composed of an odd number of spaces.

00:06:23.593 --> 00:06:26.954
 Such a threat is said to exert control over the Zugzwang.

00:06:28.100 --> 00:06:31.315
These threats are stronger. We usually want to use them first.

00:06:32.333 --> 00:06:34.686
Ok, in that case, what should Red do here?

00:06:34.733 --> 00:06:37.191
Let's start by identifying the threats.

00:06:37.233 --> 00:06:40.918
This one has 5 spaces, so it exerts Zugzwang control.

00:06:41.966 --> 00:06:44.894
This one has 3, so it does as well.

00:06:45.933 --> 00:06:47.790
This one also has 3!

00:06:47.833 --> 00:06:52.311
But, playing in it would unearth a yellow Zugzwang-controlling threat.

00:06:52.311 --> 00:06:54.525
 It's probably best not to do that.

00:06:56.600 --> 00:07:00.207
Finally, these 2 do not exert Zugzwang control.

00:07:01.233 --> 00:07:04.866
So, it seems Red's best option is to take one of these two!

00:07:06.900 --> 00:07:09.645
That way, we hand the Zugzwang back to Yellow.

00:07:11.666 --> 00:07:16.606
Now we have the foundation to understand why Yellow was winning in this example from last time.

00:07:19.633 --> 00:07:21.624
The parity of the dead space was even,

00:07:21.624 --> 00:07:26.194
 and there was no threat that Red could give up to toggle the Zugzwang back to yellow.

00:07:29.833 --> 00:07:36.731
Okay then, so are there any cases in which it is beneficial to take a threat which does not exert Zugzwang control?

00:07:36.766 --> 00:07:41.829
In this case, the lower threat does not control the Zugzwang, but the top one does.

00:07:41.829 --> 00:07:48.186
 Only by revealing the bottom one can Yellow arrive at the top threat and send the Zugzwang back to Red.

00:07:53.266 --> 00:07:55.339
Here's a much more obvious example.

00:07:55.339 --> 00:07:56.139
 In this case,

00:07:56.139 --> 00:07:59.910
 Red wants to get to the major threat pair as soon as possible,

00:07:59.910 --> 00:08:02.105
 thereby, instantly winning the game.

00:08:02.300 --> 00:08:07.108
So, red will uncover the bottom threat, and then claim victory using the threat pair.

00:08:11.133 --> 00:08:15.727
In both of these instances, we play the non-controlling threat to expose the upper threat.

00:08:15.727 --> 00:08:19.392
 There's no harm in this as long as the two threats have the same color.

00:08:20.466 --> 00:08:25.719
Therefore, since the threat will simply get trodded over, it can be ignored as dead space.

00:08:26.766 --> 00:08:29.765
However, in a situation like this, the red non-

00:08:29.765 --> 00:08:35.099
controlling threat is the only thing preventing Yellow from reaching a threat pair.

00:08:35.099 --> 00:08:40.174
 It may not help Red control the Zugzwang, but it is preventing a swift defeat.

00:08:40.300 --> 00:08:41.200
For this reason,

00:08:41.200 --> 00:08:44.775
 a threat which does not control the Zugzwang can be ignored,

00:08:44.775 --> 00:08:48.587
 if and only if there is a threat of the same color following it.

00:08:48.733 --> 00:08:56.702
Now, we learned about threats which control and do not control the Zugzwang, but this threat pair can be considered as a separate kind of threat.

00:08:56.702 --> 00:08:59.805
 Notice how the dead space above it can never be touched,

00:08:59.805 --> 00:09:02.741
 since Yellow is guaranteed to win on the threat pair?

00:09:03.866 --> 00:09:07.935
This 'terminal threat' has the property that nothing above it can ever be touched.

00:09:07.935 --> 00:09:10.297
 Anything above it might as well just not exist.

00:09:11.366 --> 00:09:14.739
The same can be said of a threat held by both players.

00:09:14.739 --> 00:09:19.887
 This threat is terminal- whoever touches it wins, so there's no getting above it.

00:09:19.966 --> 00:09:24.749
This yellow threat might as well not exist. The result would be identical.

00:09:25.766 --> 00:09:29.661
Let's look at one other type of threat which we have neglected until now.

00:09:29.700 --> 00:09:33.254
This threat chain here actually works just like a normal threat.

00:09:33.300 --> 00:09:40.423
The chained threats above the bottom one will be played in the same way that players fill the dead space above a threat.

00:09:40.423 --> 00:09:42.943
 So, the chain doesn't do anything special.

00:09:43.033 --> 00:09:48.782
And, since it has an even amount of spaces, it does not exert Zugzwang control.

00:09:48.800 --> 00:09:52.668
So, we can simply imagine that the chained threats are absent.

00:09:53.700 --> 00:09:58.352
Ok, let's see another example to see how we can use all of this.

00:09:59.433 --> 00:10:04.346
Here are the existing threats. Let's start by simplifying columns with terminal threats.

00:10:05.366 --> 00:10:05.937
On the left,

00:10:05.937 --> 00:10:10.334
 the red-and-yellow threat is a terminal, so we can simply remove everything above it.

00:10:13.433 --> 00:10:17.009
The paired yellow threat one column over is also a terminal,

00:10:17.009 --> 00:10:19.498
 so we can remove everything above it too.

00:10:22.566 --> 00:10:27.035
The chained threat in the 6th column can be simplified by ignoring the chain.

00:10:29.066 --> 00:10:31.120
The rightmost threat pair belongs to red-

00:10:31.120 --> 00:10:36.150
 there's no way that Yellow could get to the upper threat without Red having gotten the bottom one.

00:10:38.233 --> 00:10:43.405
We are also safe to ignore these two red threats which exert no control over the Zugzwang,

00:10:43.405 --> 00:10:46.257
 since there is another red threat above each one.

00:10:49.333 --> 00:10:52.731
The same is true of this yellow non-controlling threat.

00:10:54.766 --> 00:10:57.077
Excellent. Now that we have simplified the board,

00:10:57.077 --> 00:11:01.171
 let's highlight the remaining threats up to whether or not they control the Zugzwang.

00:11:02.266 --> 00:11:07.127
Ok, this looks a lot more manageable! Can you tell how this game will proceed?

00:11:07.166 --> 00:11:11.348
Red is in the Zugzwang, since there is an even amount of dead space.

00:11:13.366 --> 00:11:16.294
Red will start by toggling the Zugzwang like so.

00:11:18.333 --> 00:11:20.190
Yellow will then return the favor.

00:11:22.233 --> 00:11:23.855
Now red once more.

00:11:25.900 --> 00:11:27.809
Followed by Yellow once more!

00:11:29.833 --> 00:11:30.610
At this point,

00:11:30.610 --> 00:11:35.584
 Red has no other option but to cede a terminal threat to Yellow, thereby forfeiting.

00:11:37.666 --> 00:11:39.371
Ok, let's take a step back.

00:11:39.371 --> 00:11:45.040
 We have now taxonomized all threats into Zugzwang-controlling threats (marked with a Z,

00:11:45.040 --> 00:11:50.839
) non-controlling threats (marked with a zero,) and terminal threats (marked with a hash.)

00:11:51.966 --> 00:11:53.701
With the diagram on the bottom,

00:11:53.701 --> 00:12:00.330
 we abstract away all of the unnecessary details and boil down this particular endgame to its fundamental structure.

00:12:00.400 --> 00:12:02.776
Let's watch the players play this same game over,

00:12:02.776 --> 00:12:05.994
 but track what happens as they play hot-potato with the Zugzwang.

00:12:06.066 --> 00:12:11.371
Red handed the Zugzwang to Yellow like this, expending a Zugzwang-controlling threat.

00:12:12.399 --> 00:12:17.156
Yellow sent the Zugzwang back to red by using the threat on the sixth column.

00:12:18.199 --> 00:12:20.370
Red handed it back over again.

00:12:21.399 --> 00:12:23.361
And now Yellow.

00:12:24.399 --> 00:12:26.533
Now Red is clearly going to lose,

00:12:26.533 --> 00:12:30.320
 because no remaining red threats can toggle the Zugzwang,

00:12:30.320 --> 00:12:33.314
 so Red will end up revealing a yellow threat.

00:12:39.433 --> 00:12:44.686
Let's consider a yet more perplexing case, this time looking only at the diagram.

00:12:45.766 --> 00:12:49.269
Red's in the Zugzwang. Which threat should Red expose first?

00:12:49.269 --> 00:12:54.074
 There turns out to be a very simple answer for determining this in any situation.

00:12:54.074 --> 00:12:56.985
 The trick is to greedily take whichever Zugzwang-

00:12:56.985 --> 00:13:00.014
controlling threat has the fewest opponent Zugzwang-

00:13:00.014 --> 00:13:02.391
controlling threats immediately above it.

00:13:02.633 --> 00:13:03.277
In this case,

00:13:03.277 --> 00:13:04.883
 that's the bottom-left threat,

00:13:04.883 --> 00:13:09.588
 since there is no yellow threat immediately above it- there is another red threat there.

00:13:10.733 --> 00:13:16.456
Now, Yellow would expose the only immediately available threat.

00:13:17.499 --> 00:13:19.691
Red now takes the second-column threat,

00:13:19.691 --> 00:13:23.434
 since it only has one yellow threat stacked immediately above it.

00:13:24.533 --> 00:13:29.002
Yellow now takes the third-column threat, since it has the smallest red stack above it.

00:13:30.033 --> 00:13:31.446
Now red...

00:13:32.466 --> 00:13:33.644
And yellow...

00:13:34.666 --> 00:13:35.739
And red...

00:13:36.766 --> 00:13:40.069
Now there are no more exposable Yellow threats left,

00:13:40.069 --> 00:13:42.727
 so Yellow exposes a Red threat and loses.

00:13:43.799 --> 00:13:49.444
I'll leave it as an open puzzle for you to demonstrate why the greedy algorithm always works here.

00:13:50.466 --> 00:13:57.077
Understanding what we've covered so far is more than sufficient to derive the win conditions of the standard board size.

00:13:57.099 --> 00:13:59.603
Now that our endgame theory is basically complete,

00:13:59.603 --> 00:14:03.791
 let's see how to actually apply this, by categorizing some common threat patterns.

00:14:04.866 --> 00:14:05.545
In practice,

00:14:05.545 --> 00:14:10.781
 one or two columns with threats are common to see, but 3 or more is increasingly rare.

00:14:10.781 --> 00:14:14.133
 Since our parity mechanics explain the one-column case,

00:14:14.133 --> 00:14:17.910
 let's determine the win conditions for two threatened columns.

00:14:19.099 --> 00:14:23.668
When two yellow threats with nothing below them are both on even rows,

00:14:23.668 --> 00:14:26.455
 or both on odd rows, then Yellow will win.

00:14:26.455 --> 00:14:29.242
 Red's in the Zugzwang and can't toggle it.

00:14:33.366 --> 00:14:38.462
If Red has two threats with one even and one odd, then Red wins by the same reasoning.

00:14:42.499 --> 00:14:46.342
What about if each player has a Zugzwang-controlling threat? It's red's move.

00:14:50.366 --> 00:14:51.779
It's a tie!

00:14:52.799 --> 00:14:55.469
If we give Red 2 Zugzwang-controlling threats,

00:14:55.469 --> 00:15:00.327
 that will be sufficient to overpower Yellow, who is in the Zugzwang to begin with.

00:15:08.399 --> 00:15:10.650
Flipping around the position, we get a tie.

00:15:10.650 --> 00:15:15.039
 Not a yellow win- yellow is disadvantaged by being in the Zugzwang from the start.

00:15:23.133 --> 00:15:27.456
Since a second and fifth row threatened column exerts Zugzwang control twice,

00:15:27.456 --> 00:15:30.019
 yet third and sixth rows exerts it only once,

00:15:30.019 --> 00:15:33.092
 Red wins this one since Yellow starts in the Zugzwang.

00:15:43.233 --> 00:15:46.605
If we flip it around, the game ends as a tie.

00:15:55.633 --> 00:16:00.297
While there are an unending amount of different ways that columns can be threatened,

00:16:00.297 --> 00:16:04.231
 by using the tools of reduction and abstraction which we learned here,

00:16:04.231 --> 00:16:06.987
 it can be rather easily determined who is to win,

00:16:06.987 --> 00:16:11.707
 even on arbitrarily large board sizes where we haven't memorized the win conditions.

00:16:11.899 --> 00:16:14.488
What we have done here was no mean feat-

00:16:14.488 --> 00:16:18.067
 we have effectively and absolutely solved the endgame.

00:16:18.067 --> 00:16:20.325
 Now the task is to work backwards.

00:16:20.325 --> 00:16:24.102
 Is there a way that we can comparably reduce the midgame?

00:16:24.102 --> 00:16:26.361
 The answer is, in many cases, yes.

00:16:26.361 --> 00:16:27.102
 Stay tuned,

00:16:27.102 --> 00:16:33.649
 because we will start to get a feeling of the shape of certain weakly solved subtrees of Connect 4.

00:16:33.999 --> 00:16:35.830
This has been 2swap.

