A brilliant reduction that elegantly maps Boolean logic onto a hexagonal grid to reveal the hidden complexity of a simple game. It is a masterclass in making abstract computational theory both intuitive and visually compelling.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
HeXO is NP-Hard
Added:Okay. Uh, okay. Welcome to my presentation. Today we're going to talk about why Hexo is NPR. I'm going to talk about later what exactly this means. So, first of all, uh the rules of Hexo. If you don't already know the Hexo is a game uh a two-player game edated by web code guy, which is also on this uh discord server, so you should probably know him. You can find him on YouTube.
Anyways, it's a strategy game on an infinite hexag hexagonal board. Uh, in each turn, a player places two color access. So, what this means is that, of course, it's a infinite uh hex chess board and on the first turn, the first player places one stone and then after that, each player places two stones. So, for example, I've uh set up that player one is a color yellow and player two is blue. So, this is a pretty good strategy game. Whoa. It's a pretty good strategy game. And the the the objective of this game is to make six in a row. So, for example, in this position, yellow can if he makes six in a row, he wins. So of course uh player player two has to avoid this. So for example this is a position um and this this is considered a threat in my in my program I have this showing basically. So blue has to block this threat in order to not lose the game.
Okay. So we will show MP hardness by simulating SAT or reducing the program to SAT SAT. Uh so uh a a such problem is basically this kind of problem. It's a string uh of all statements uh all end together. So all of these statements have to be true at the same time. And this is actually an MP complete problem. But I will explain later what this means. Just know it basically is a very hard problem that if we could solve it in polomial time basically we will solve it the majority of problems in also polomial time.
So yeah, we will need to create uh some logic gate in uh in hexo. The end gate, the or gate and the not gate is difficult to create. Uh but we will create a mechanism so that if a player chooses um for example not a then yes a will automatically be uh false. Okay. So then the MP hard question will be uh for a arbitrary position is this position one for which player?
Okay. So uh right. So we will trans um transmit signal by making this sort of construction in which yellow makes a double trap which is basically a threat that um the blue player has to respond with two moves. In fact, if player blue has even one uh move available, he wins because there is this uh we will basically put in our this position this uh formation.
And this obviously a quadruple threat for blue. So if yellow plays perfectly uh he should in every turn make a double threat every move, every turn, sorry. Uh so is a a wire. So basically this is an input and if the input is on then yellow can make a double thread which is blocked by these two blues and yellow can continue making making the the wire gone. Um in theory yellow can also not transmit the signal but it is in like he wants to do it if he wants to win because uh if he doesn't blue just wins right away basically. So yeah, this works by creating five in a rows and if you remember six in a rows make the make player uh one win. So blue has to respond and so we'll defined cheating in this system which is basically um cheating is not supposed to happen of course but cheating is basically when yellow can create a winning opportunity even though it's not supposed to. So I hope there is no cheating in this position basically in this wire. Um but every uh every other move yellow can make is either um transmitting the signal or it just kills off the signal which is a bad thing for him. So this is another Y and I actually corrected this very recently because I didn't realize a cheating error basically. Uh so this is a horizontal wire and this is a another wire which is interesting because it actually uses four in fours in a row it makes two for arrows and this is actually useful because um it basically shifts around the parity of the wire so it will be used and this is another why I never use it uh but it just it's just good to have you know so this is the first gate we've created the end gate as following and this the functioning okay this is not very clear but I will just show you. So first of all this is the wire that the signal passes through and basically this five in a row activates only when both of these signals arrive and therefore I can transmit the signal uh onwards. So I'm going to show you an example. This is our final construction of an example basically. Uh where is I believe this is an end gate. Wait, wait. Whoa.
Yes. Okay. This is an end gate. So, for example, these are inputs. So, I have Okay.
So, yellow and blue has to transmit signal is in this way. So, both of these are on like this.
And whoa, there is a mistake. Okay.
Maybe I'll just place a yellow here.
It's fine. And okay. And then so the signal is transmitted and as you can see there's a three arrow now which is only possible if uh both of the signals are on and so the the signal is keep is transmitted. Uh right so I don't think there is cheating in this.
If there is I can probably fix it I guess. I don't know maybe yes maybe no but it's definitely possible. It's just an an example. If one really tries it could probably be very compact design. I don't know. Uh yeah. So also no there is an important thing that no win condition for yellow can be made because if there is a win condition then uh it it doesn't work. Everything doesn't work. This is an orgate and it's actually very similar uh to our end gate. Um so let me just load up this and find one.
Yeah, this is our gate. So well how does it work? Basically there is this line this uh green line um and there are two wires which transmit the signal and if any of these two um hexes are filled in then a player can make either four or five in a rows in this green line and then the signal can can transmit. So let's let's see. So wait I have to okay yellow. Okay. So suppose the these are the the inputs because the signal is transmitted. So I put two here and then two here. Uh two here. Yes, two here. So the signal is transmitted in this way.
And as you can see I put five in a row here. And now this line is already capable of doing four in a row. But actually it's a double thread because there is no blue in this line. Uh so yeah the point is that if we fill in this hack we can continue the signal basically and this works also if there is a signal here or both actually uh yeah so no is possible uh as as at as at least as far as as far as I'm aware or no wind condition is possible.
Okay uh so this is the knot. Uh so as as I said before the not is not is not actually a possible gate to create because the player could just uh simply never um how do I say it's not possible because in theory a player could be advantaged if a if a wire is off for example uh but a player could just decide not to go ahead and um continue the wire like a player could just stop not not make the the signal go through and therefore a not gate could be created in every position. So we will make a not gate in another way which is basically simply two uh two wires one for a a yes and one for a no basically for the same variable and this is actually a very similar construction to another video I saw on the three cycle uh uh channel but anyway uh so basically how this works is uh a player this is a variable right and a player makes five in a row here and blue blocks offs in these two squares and the signal goes on. But if a player go do does another one of those five in a rows, it creates a threat for blue. And a threat for blue basically mean yellow has to respond.
And so blue can win instantaneously. So we will look at our example, right? Uh I have okay the moves. Okay.
So for example, I I decide this is the yes a. So a is on in this wire and so the trans the the signal is transmitted.
But if yellow decides to make another uh so for example both yes and no at the same time as you can see blue creates a threat and if yellow threat respond it creates a double threat instantaneously and wins. Therefore only one of these two can be on at the same time.
Uh right and of course no cheating is allowed or at least I hope so. So this is another wire which is not really necessary but I will create it which is a a duplication of the signal. So in complicated SATs it might be needed to duplicate the the the wire the the signal and this is a very easy thing to see if we have a three in arrow here. So this input is on these two are filled in and then we can continue to making five is narrow. I actually don't use it in our final construction uh because it's not necessary every everything is used only once. Uh okay and this is also pretty necessary is just crossing the wires crossing signals without them being uh mixed with one another. And this is actually used in my construction. So this is actually pretty simple because uh it's just symmetrical and the signal one it goes like this uh around this axis basically and this is filled in so they not do not even connect. So the final wire we will be making is more like an end gate and wire. Uh so basically this an end uh yes end gate and this kind of end but basically if they are bought on the player makes a six in a row they makes a triple threat basically yellow and this is very similar to an end gate. So yeah when both signals are turned on uh it creat a row or four in a row actually but they are two fours in a row one is free which basically makes yellow win and again I think there is no cheating or to create win condition a way to create win conditions without both uh wires being on.
Okay. So SAT is now possible because we made every ingredient basically and yeah so we creating this SAT uh in in the simulation and this is a pretty simple SAT because I'm lazy and I didn't want to do a more complicated one. So right so this is the diagram we will representing. So if you can look at this uh SAT it's basically the same thing right it's a or not a b or not b c or not c and this is the are or gates and these are and gates and so this is the diagram we will be making so this is it uh abc and this is basically the same diagram of course it's not the same because the wires are diagonal but it's the same spirit Uh would you mind if uh I I actually complete the whole uh the whole diagram the whole essay?
>> Yeah, that sounds like fun. Let's try it.
>> Okay. Okay. So, I will just be making you look at this. What do you want to choose for A, B, and C?
>> Um uh I don't know. I guess I'll say A is true and B is false and C is true.
[sighs] >> Okay. Okay. Okay. So A is true. You said yeah.
>> Okay. Just for Okay. Yep.
>> Yellow. Okay. So A is true. Whoa.
>> And and so in theory, right, we if we actually had like a hexosolver or even like a like a depth 2 hexo reader, um we should be able to actually solve this.
So yeah, basically what this means if uh is that a a perfect player for this game um basically it cannot be polomial or at least we we don't think it is because basically if it was polomial then P would equal MP and we will solve the million question problem question dollar question so yeah it's arbit so basically what this means is a position is arbitrarily complex okay so you said uh in the chat it says that won't satisfy the SAT expression.
What do you mean by that?
>> I think he's saying that >> yeah I chose were not uh sat satisfying the the expression. So, okay. A, not B, right? Not B and and not C or C, I don't remember. Not C.
>> Uh, I think I said C, but not C is also fine.
>> I think not C actually completes the SAT. Okay. So, uh let's go on with the wire.
It may be uh may actually take a long time.
because the it's it's pretty large of a construction so it may take some time.
Yeah.
Well, so okay, wait a minute. Um, so when you're doing that wire there, like in theory, yellow could sort of >> yellow could jump ahead, couldn't they?
>> Okay. So, for example, say that this is an input just shifting the Yeah. So, suppose this was an input, right? What do you mean? Like I could do this, right?
What you're saying?
>> Uh, or what? Oh. Uh, >> if I do this, it's still >> I'm just imagining like yellow like plays. Um, I guess move your mouse to the up and to the right a little bit.
>> Um, >> uh, I mean, where >> uh, like this >> over over three. Yeah. Yeah, that'll work. That'll do.
>> Yeah, but this is a four in a row, right? And this is blocked off. So, it takes just one move for blue and I can win >> here.
>> Try the um, Right. Try the try the one that you showed just a moment ago where you play like two elbows, two consecutive like corners >> like this. So basically I I just create two fors two fours but it it takes two moves to >> to block off.
>> So even though it is a different method, it's still not cheating.
>> I see. Okay, cool. Thank you.
>> And actually it's faster. So maybe I should do do it. Okay, so this is our orgate. So C or B as I said. Uh yeah. So I will just complete it. It's an all right. Yeah.
So of course perfect play from yellow.
Uh right. Oh wait, there's a mistake here. Wait. Anyways, uh perfect play from yellow is expected because yellow wants to win, right? So, um, not continuing the Y is not a a rational decision, right? So, wait, what what is this?
This is supposed to be a um Oh, yeah.
No, wait. What?
Maybe I made a mistake. It's supposed to to uh What?
Oh, wait. No.
>> Isn't that like the crossing over?
>> Yeah. Yeah. But I I Wait, I don't I don't remember how to do it.
Oh, yeah. Yeah. No. Oh, I I put this wrong. It's supposed to be yellow here, maybe.
Wait. Anyways, this is supposed to make the the wire go here. No, not here.
Here.
So, I'm just putting some things here because the parity doesn't match.
Okay, as I said, there may be some errors, but this is just a theoretical, right? So, this is another mistake I made. Uh, it's supposed to be here. No, wait. Here.
Okay.
Okay. Yes.
So, yeah, I made some mistakes.
Oh my god. Okay.
Right here.
Here.
Okay.
Oh, this is blocking off. Okay, fine.
Okay, so this is an end gate. So, we need to go fill out something else. So, the not B goes up here. So, I won't fill out the whole wire. I just see where it goes. So over here and over here, right?
So I just do something like this. Okay.
And this is an orgate.
So the wire goes here, here, here. Okay.
It goes here. I will just make a couple of move here. Okay.
Uh All right. The yellow supposed to make this move. Don't worry about this threat. I I forgot about it. It's a mistake. Anyways, so right this is continuing. So your example um so this goes here, right? Okay. So this is an end gate, right? This means both signals must be turned on. Uh however you said that like this is supposed to be either not C or not A but no they are not turned on. So this signal will never be turned on. So I don't think we will be able to achieve a win in this position.
Okay. Uh so now a bit of theoretical um things. So yeah, we are we we proved MP completeness even though there are a couple of mistakes.
Um so yeah this is not possible. Cool.
Okay.
Uh uh what is completeness? No sorry can we prove MP completeness? Right? Because it's a different thing from MP hardness.
Uh so an MP hard problem we will show you the graph. An MP hard problem is basically a problem which is as hard as any MP problem. An MP problem is just a a problem which takes polinomial time to check for. So if I have a solution for an MP problem uh then there is a certificate that takes a polinomial time to check basically if this solution is correct. However, the MP problems could actually be we don't know but it could be actually super exponential or sorry exponential super polomial time to actually find the solution. NPR problems are problems which could be in MP or not that can basically simulate every MP problem inside of them or in this case the MP problem um I don't know how to I don't remember how to say basically we can simulate the MP problem inside the MP hard problem and this means that if we find a solution to an MP hard problem a polomial time solution to an NPR problem then we find also a polinomial time to a solution to on MP every MP problem. MP complete problems are MP hard problems. So as hard as every MP problem, but it's also inside MP. So a solution to an MP complete problem is checkable in polinomial time.
However, um uh to check if a solution is a best in arbitrary position in X. So it's likely not easy to prove in polinomial time because maybe a a position is very complex.
Uh wait I I see something in the chat.
Would it be possible to generalize this to QBF by allowing blue to choose certain certain variables? Uh can you remember what be what is QBF?
I don't know what it is.
>> I guess I'll just talk. Uh so like a sad problem you have like there exists um certain variables right like there exists a b and c such that this statement is true. Um, QBF is like you're allowed to use for all, right?
It's like for all A there exists B where for all C this statement is true. Um, so you're allowing >> Yeah. So what I'm wondering is like you're allowing yellow >> Yeah. You're allowing yellow to choose certain variables. I'm wondering if you could then allow black to choose certain variables as well. And then >> well I don't know actually because in this scenario or what do I call it in this scenario blue has no initiative because if it had it would choose to win the game right away. So I don't know because um the point of this simulation is that yellow has to make double threats. So blue has no choice but to respond to those threats.
>> Yeah. Admittedly I'm not actually very good at hexo. I've not played hexo ever.
But um yeah, I feel like if you have like two four in a rows, then you could just like allow uh Oh wait, no.
>> So if you have two for two for a rows like >> so a four in a row, a three for a row is actually a double threat right away.
>> Yeah.
>> Yeah. Block on one side and then a second four in a row that is just a double thread.
>> Oh, we could allow yellow >> like we could give yellow the ability to create double threats, right? Like yellow having the initiative might be enough here, >> right? What I don't What do you mean?
Like yellow >> if yellow is yellow is able to favorably create uh like four in a row threats within one move, then maybe yellow could like selectively start new wires.
>> Oh yeah. So basically the thing that like this but more more selectable variables >> right exactly I I think so >> I mean it wouldn't work for infinite variables because we would need infinite many infinite many space or place stones right if I don't know maybe there is a setup where blue actually can have the initiative without winning instantaneously. But I have no idea if this is possible.
Okay. Uh so okay, we can go back, right?
So hexo is likely not empty complete because to check whether a move is the best in a position is likely uh not checkable in polinomial time because it basically tells you okay now we are in this position. Is this the best possible position position we could be in? And it's likely not possible to know in polinomial time. [snorts] Okay. Uh so here are some more NPR questions. Actually it's just one in hex. So uh okay. So Z says I feel like we should try to prove P space completeness.
Uh okay. So I don't know what that is but I mean oh yeah I know what that is.
It's space. So it's uh memory related probably.
No, it's likely possible anyways.
So yeah, uh this is an RPR question which we just proved that solving is this position one for player one or player two is MP hard at least. Uh but some more questions are for example can this pattern appear?
Because if I just put some pattern at the end and it can only be achieved by yellow putting both of these which is basically set SAT but for completing a position then the question can this pattern appear assuming perfect pay of course is also an NPR question.
Okay. Uh so yeah I I yeah saw that uh in a few weeks oh no wait a few days actually uh someone is proving peace space completeness of go I believe or a a generalization of go uh so so yeah so I think this is my the end of my presentation I went by a little bit fast and I apologize if my um it wasn't the best for my accent or something. So, do you have any questions?
>> Thank you. Um, I think that was pretty cool. I I think I followed all the ideas. Um, I mean, of course, I think you would be left with like the task of actually proving that your construction works and there's no like cheating involved, but like I imagine that you could like effectively run the the thing without any clever like oracle of hexo.
Like all you need is just like a bot that can search to a depth of like two or something. And um like if you're you know if you if you have that bot then you can evaluate the circuit but not necessarily solve the the problem which is the hard part.
Well yeah if well but a a bot like this construction takes a lot of moves to to evaluate. So a two depth bot wouldn't be able to actually solve this right.
Oh, well well I mean but you couldate all like all like all wrong moves, right? Because there's only one move that doesn't result in you losing right away. So all of the moves are pretty much immediately forced, >> right? Yeah. Well, yeah, it's it's because once we select the variables, then it becomes SAT automatically. So yeah, it evolves naturally.
Yep.
[snorts] >> Okay. So, no more questions. No, >> I was uh still a little confused about the discussion about the not gates >> like that's pretty important for NP hard that like you have maybe not not but something like how can we get what we want out of this?
>> So, you're asking about this, right?
Yes.
>> Okay. So, basically uh the yellow chooses one of two um wires basically and we just say like the upper one is true. So, A is true and the down one is false A. So, A is false. So, basically what this means is that uh yellow has to choose sooner or later because he has to make a double threat. if he if he doesn't uh he loses. So he's forced to make a choice, right? And sorry and he can cannot make both wires on at the same time. Because if he did, okay, for example, say it is yellow's turn right now. No. And I make this double threat, then blue blocking makes a double threat. And if blue makes a double threat, then he automatically wins because blue can make this quadruple threat here. So what this means is that hey uh sorry yellow s is forced to make a choice basically for which variable is true or false and this is the the mpr question basically because the choice of these variables is basically entailing the this SAT problem.
Did I answer your question?
I will comment here briefly. I think so I think what's going on maybe >> is like this isn't actually like a true notgate but rather like a selector that you have at the beginning.
>> And this is okay because like we know that our like we don't have to take general knots of like general boolean expressions but rather we can just get away with doing like all the knots in the beginning. Um because we could just like use like de Morgan's laws to um construct a more complicated knot and like we're given that like I forget the name of the like the boolean expressions where you have like the the ands on the outside and yours on the inside but that's what we have. So I think we can get away with this like selector to start.
>> Correct me if I'm wrong.
>> No. Yeah.
>> Yeah. For the stat problem, we only have negations of variables and that gives us >> right. So I I don't know if that works as a generalized or not. It seems to me like maybe it doesn't, but that's that's okay for the proof.
>> Actually, I think that in this setup where there's are there are wise in this specific case, it's actually not possible to create a a a not gate because one can just like don't not continue the wire and it's basically just a not, right? So it would be impossible to actually know whether a wire is actually off or on.
It's just like an off gate is the same as no no signal transmitted. So there's no way to know that. But this the these selectors are fine because in this SAT the what um the variables are negated at the start.
Right. So no more questions. So can we can end it.
>> Thanks a lot. I appreciate it.
>> Okay, >> I'm going to stop the recording.
>> Okay, thank you too and I hope you have a good day.
>> You too.
Related Videos

Definition:Bounded variation and if f is monotonic on [a,b] then f is Bounded variation on [a,b]
wingsofmathematicsbytanush2507
4K views•2019-09-05

Prof Chris Holmes | Bayesian fitting and evaluation of complex models arising in...
uclfacultyofpopulationheal9290
564 views•2019-07-03

Patrick Landreman: A Crash Course in Applied Linear Algebra | PyData New York 2019
PyDataTV
9K views•2019-11-30

Approximating the Standard Deviation from Data of a Histogram
donnasmith8529
15K views•2019-09-26

HSC Maths Standard 2 | "At Least One" Probability Rule
ATARNotesHSC
697 views•2019-05-20

Spectral Sequences Live! 17: The Grothendieck spectral sequence
k-theory8604
395 views•2025-11-10

Structural Equation Modeling for Beginners
QuantFish
1K views•2025-09-30

Exploring Practical Applications of Linear and NonLinear Models In Business Research Dr.Jeelan Basha
MallikarjunaDKaggal
258 views•2025-05-26
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23