free web page hit counter
🛡️
Copyright Notice: This video is officially sourced and embedded from YouTube. For all copyright inquiries, reports, or removals, please contact YouTube's legal team here.
Sebastian Lague

Sebastian Lague

1,400,000 subscribers

⏱ 👁 1,399,455 views

Algorithms Explained – minimax and alpha-beta pruning

Video Overview & Insights

This video covers the minimax search algorithm, as well as how it can be sped up using alpha-beta pruning.

“

Loved how clearly you broke down minimax and alpha-beta pruning — AI can help with this kind of dense topic too. A handy productivity tip is

— @AllinOneAPIBelowOfficialPrices

Pseudocode:

https://pastebin.com/VSehqDM3 - plain minimax

“

So when I tried to implement Negamax for my Chess engine, I found that the basic Negamax search worked but when I tried alpha beta pruning, it seemed to be deliberately avoiding checkmate????? I have no idea why because I thought I was following the exact steps, and I thought I was converting everything correctly...?

— @legendgames128

https://pastebin.com/rZg1Mz9G - alpha beta

Support the creation of more tutorials:

“

so nice

— @jennifertran9514

https://www.patreon.com/SebastianLague

“

awesome explication, got me to understand

— @ReginGamer

More User Perspectives

@

我可以战胜ai

@ziqideng-o2d
@

I am trying to write my own chess engine and your video was the most helpful one so far, tysm!!

@AmazingStopMotions
@

are you genius

@ghjadf3654
@

ty

@AvamNeupane-qk9fd
@

Thank you!!! I'm in a class learning minimax and alpha-beta pruning algorithms and I felt completely lost after a couple lectures, but now i get it.

@MyghtyMediocre
@

Best video about alpha beta pruning I've seen. Thank you so much

@monjasonsteng7861
@

Благодарим ви!

@chavdarmarchev3666
@

Excellent, really well explained, thank you!

@jocaro93
@

I don't really understand the code and the alpha-beta part...

@ReginaJin-k9j
@

+50 slides explained in 11 Mins ❤

@SuperNovaxFF
@

I get mired in the details every time I read up on this, in spite of my CS degree. But then it was in the 1980s. And I am old. However, the idea is very clear. Stop searching when it's obvious non of the other child trees will get played by a sane, observant player. chatgpt claims older electronic chess computers didn't understand enough ( their programs were too simple) to do good move ordering, so they had to waste time. But they often don't look that deep anyway. I am thinking 1980s electronic chess computers with typical slow CPUs, under 10 Mhz roughly. 100 million instruction cycles per second, which is probably more like 30 million instructions per second. Some of those CPUs were 4 bits, which meant programs were even slower, when they had to do extra work to compensate for their small word size.

@michaelbauers8800
@

Right children are always the unloved ones...

@samiourov
@

great vid, thanks

@Cr0NiiX_
@

I've been a subscriber for years and clicked on this video just now to help me with a midterm for my Intro to AI course not even realizing this was a Sebastian Lague video until I heard the voice. Crazy how me watching interesting code videos has lead to this!

@Squish_Squash
@

Prune

@giulianogarridorocchetti4902
@

This one single video explained a whole chapter so much better than my Indian professor who couldn't explain this in multiple videos

@Irteza-c6r
@

Is alphabeta with pruning the only algorithm for such games?

@Georgios-ft5nm
@

Hey Sebastian, thanks for the walkthrough and explanation. This has made the picture infinitely clearer to me. I hope someone buys you a shot or something! Cheers

@Kasual1911
@

I didn't quite understand why the code for alpha beta works?

@aaryanhindi2059
@

7:35 I don't understand, white might pick the node to the right of <=1, in case it is <=10. This would beat 3. So I don't think pruning is allowed. Please correct me if I'm wrong.

@MaxPicAxe
@

7:33 I'm not understanding how this can be deduced. Isn't the possibility for max to play optimally and go down the right path still... possible? Since the rest of the values determine whether or not 1 is guaranteed

@KojoBailey
@

Great video , thanks for sharing!

@mrb12865
@

what a brilliant explanation, I rarely understand a topic from a single video but this time I understood the game playing algorithms just from this video

@taki9873
@

One of the best explanation. I really like it that you explain it from intuition.

@jasonhe6947
@

How come in this video you don’t have that annoying voice from your recent videos? You got superb over time I guess.

@baomaspiano7736
@

This is genius. Saved a lots of computation calculation

@Jonathan_Wen
@

I don't get the pruning part though, because how can we assume that <=1 is the case in the parent? What if the other child was much bigger? We didn't even check?

@Taro-wd5uo
@

see barsh.

@michaelstoll6167
@

Such a great video thank you so much what my lectors explained in 30 pages u did in 11 minutes

@stealth1841
@

Great video! Super understandable, clear, and well presented. Gave me a great start to my minimax algorithm for my Berkley PacMan assignment!

@tylerhilbig3974
@

Thank you so much !!! Save my ass from the mid-turn exam !!! 😘😍😍

@JerryJiang-zg1qg
@

This is such a great explanation!!

@ashithshetty
@

cool, easy to understand. thanks for making the video

@DaDeckyz
@

Got it thx

@irichx
@

You are the man

@charleslingande6673
@

thank you

@jirkadolezal8127
@

this is so well explained, thank you so much!

@mairalyss
@

Very interesting, I wonder how such algorithm can be upgraded for a 3-players game, alpha-beta-gamma pruning with 3 maximizers of own individual scores?

@zix2421
@

The best video ever

@wingedvictory8694
@

this video has a different vibe

@Razamindset
@

Wow. helped me a lot after struggling with it for days. thanks boss!

@AmanSiyaramPathak
@

F**kin love this ❤

@deadlygaming7450
@

Great explanation!
Thank you! It helped me a lot!

@danielpereyra9860
@

not a coder but a chess player, learning how stockfish works and reduces the processing load were fun to learn!

@ardasnnnn
@

you're the only one who provided code for alpha beta pruning tysm

@hgjgjfjfmd
@

Beautiful explanation. Just implemented this for an assignment but didn’t understand it at all, this cleared it up 100% in under 10 min

@aa1234-h6v