How does a Board Game AI Work? (Connect 4, Othello, Chess, Checkers) - Minimax Algorithm Explained

In this video I build up the intuition for how an expert level board game AI works. We start with a very simple approach of making random moves and then progress to building board scoring heuristics and then finally to the minimax algorithm.
I will try to make a video on how to actually program this type of AI in python within the next few weeks. Make sure to subscribe to not miss that!
As a bit of background, the minimax algorithm was the same basic algorithm used in IBM Deep Blue that defeated Chess Grandmaster Gary Kasparov in 1997.
Link to my first video on how to program Connect 4 in Python:
• How to Program Connect...
Read more about the Minimax Algorithm:
en.wikipedia.org/wiki/Minimax
en.wikipedia.org/wiki/Alpha%E...
en.wikipedia.org/wiki/Monte_C...
Link to Stanford Paper on Othello AIs that I got some diagrams from:
web.stanford.edu/class/cs221/...
Link to Medium Article on Programming a Chess AI:
medium.freecodecamp.org/simpl...
Thank you guys for supporting my channel! Make sure to through this video a thumbs up and also subscribe! :)
Leave me a comment on what my next video should be on!
-------------------------
Follow me on social media!
Instagram | / keithgalli
Twitter | / keithgalli
-------------------------
If you are curious to learn how I make my tutorials, check out this video: • How to Make a High Qua...
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! www.kite.com/get-kite/?...
*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.

Пікірлер: 40

  • @martincheung6776
    @martincheung67765 жыл бұрын

    You made this super easy to understand. Keep it up!

  • @hamzapaxton7673

    @hamzapaxton7673

    3 жыл бұрын

    dont know if you guys cares but if you guys are bored like me atm you can stream pretty much all the latest movies on InstaFlixxer. Have been streaming with my brother lately xD

  • @alexanderkonnor3285

    @alexanderkonnor3285

    3 жыл бұрын

    @Hamza Paxton yup, I've been using Instaflixxer for since december myself =)

  • @vinaypatil7293
    @vinaypatil72933 жыл бұрын

    This video really helped me with my assignment. Kudos to your work.

  • @kirbymia6209
    @kirbymia62095 жыл бұрын

    This is such a good video! Really explains minimax algorithm in a way that makes me confident enough to begin programming it. One thing... the link to the Stanford paper is broken, please check that out if you can. I would really appreciate that. But again, thanks a lot!

  • @ScarPunk
    @ScarPunk Жыл бұрын

    Amazing you make this topic super clear to me !

  • @astra7955
    @astra79553 жыл бұрын

    Thanks for the video, that is exactly what I was looking for ^^

  • @kaverirv
    @kaverirv2 жыл бұрын

    Thank you for the knowledge and undestanding you have provided here...your the best!!!!!

  • @moazelsawaf2000
    @moazelsawaf20005 жыл бұрын

    Great video sir ❤ Thanks a lot ❤

  • @lisajizz1739
    @lisajizz17394 жыл бұрын

    Thanks for awesome now I got it I've tried to finding this connect 4 game

  • @TheFatLeprechaun
    @TheFatLeprechaun4 жыл бұрын

    Thank you for this informative video. It's really well explained! I was wondering if you have an updated link to that Stanford paper, the one in the discription doesn't work anymore!

  • @david12kk5
    @david12kk53 жыл бұрын

    great video

  • @jonmerladet6465
    @jonmerladet64654 жыл бұрын

    Great video!! I am implementing 4 connect, but my heuristic function is pretty simple. I am thinking of implementing an heuristic vased on threats (even and odd threats). Which would be a way better AI. Any ideas on how to implement it?

  • @beri4138

    @beri4138

    4 жыл бұрын

    My AI tries to create non-blocked streaks of 3. If there's no way to create one, it puts a checker as close to the center column as possible. It's very strong.

  • @bernardiyawe
    @bernardiyawe5 жыл бұрын

    I'm ready

  • @mohamedchikhessbiti5936
    @mohamedchikhessbiti5936 Жыл бұрын

    Thanks

  • @burhanuddinmoizali3955
    @burhanuddinmoizali39554 жыл бұрын

    How we can implement Deep Reinforcement learning in this model

  • @mattbertoncello6739

    @mattbertoncello6739

    4 жыл бұрын

    I haven't created an AI with DRL yet, but from my experience using genetic algorithms gets the job done. Generate multiple AI's with randomly generated 'scores'. Get them to play games against each other and use the frequency of wins as the 'fitness' metric. After each generation kill the AI's with a low win frequency and get the AI's with a good win frequency to cross breed (ie, merge their 'scores'). See if after a few generations you get a good AI with tuned scores.

  • @chzmo

    @chzmo

    4 жыл бұрын

    quite amazing : )

  • @stephenjacob2241
    @stephenjacob2241 Жыл бұрын

    7:57 will not that make 3 horizontal lines instead of 2?

  • @kylieying2
    @kylieying25 жыл бұрын

    Great video!!! Highly recommend subscribing to Keith's channel!

  • @pedrossoares
    @pedrossoares4 жыл бұрын

    I would like to use this heuristics in my project. How can I reference in paper?

  • @KeithGalli

    @KeithGalli

    4 жыл бұрын

    I don't know off the top of my head. I would just google "how to cite a KZread video in a paper". Here's a link I found quickly by doing that: libanswers.snhu.edu/faq/8628

  • @bwcompanyllcwu4699
    @bwcompanyllcwu46994 жыл бұрын

    Cool

  • @DriveBoyDogBoy
    @DriveBoyDogBoy5 жыл бұрын

    I am confused as to why Column 2 became -100 (8:32) if the AI was not looking ahead. As far as I can see it should be a +5

  • @thiccaxe

    @thiccaxe

    5 жыл бұрын

    No, because then red can place a token on top of yours, making a 4 in a row

  • @beri4138

    @beri4138

    4 жыл бұрын

    @@thiccaxe The AI was not thinking ahead you dumbass. This is a heuristic function WITHOUT a search. The reason it became -100 is because it gives the opponent a "winnable line of three" which is a static pattern that you don't need to plan ahead in order to recognize.

  • @internet_user1131

    @internet_user1131

    2 жыл бұрын

    @@beri4138 Chill the fuck out

  • @uriharel6849
    @uriharel68494 жыл бұрын

    but in Othello, you don't need buffers because the AI will never choose them. After all, he thinks forward and he knows that if he puts in the buffer the human will put in the corner.

  • @markuslacht7076
    @markuslacht70764 жыл бұрын

    Note that this just works for 2 player games not for e.g. 4 player games.

  • @beri4138

    @beri4138

    4 жыл бұрын

    Bruh minimax works for any number of players.

  • @konstantinpluzhnikov4862
    @konstantinpluzhnikov4862 Жыл бұрын

    0:37 like for Harry Kasparov!!!

  • @MowGohhldRequired
    @MowGohhldRequired3 жыл бұрын

    Me: "Lets build funny game!" Reality: "Your game looks good. But What about AI?" Me: "Naaa! Me too stupid to do that!" *crying Keith Galli: "No. You not stupid. Let me show you MiniMax-Algorithm. You can handle that." Me: kzread.info/dash/bejne/daSl0tODpqXFYco.html

  • @user-he2ly4up2g

    @user-he2ly4up2g

    3 жыл бұрын

    no

  • @siddhant3852
    @siddhant38523 жыл бұрын

    can I get a transcript of this , I want to make a school project with this

  • @krenze1164
    @krenze11643 жыл бұрын

    Am I the only one not knowing Othello?

  • @darwinsexplosions
    @darwinsexplosions5 жыл бұрын

    Second

  • @spidaman0112
    @spidaman01122 жыл бұрын

    Connect 4 1st player can always win.

  • @mr.cheeseweenie6947
    @mr.cheeseweenie69474 жыл бұрын

    this is slave labor