Coding an UNBEATABLE Tic Tac Toe AI (Game Theory Minimax Algorithm EXPLAINED)

preview_player
Показать описание
Use the Minimax Algorithm to code a tic tac toe AI that is literally unbeatable. It is undefeated. You can tie, but only if you play optimally. Find out what happens when you pit AI against AI.

Want to learn Python if you are an absolute beginner? Check out my in-depth beginner series:

In this video, I explain how the minimax algorithm can be used to find the most optimal move in a game of tic tac toe. The algorithm never loses. Then, I delve into a technical explanation of my code and what each line represents.

Feel free to leave any questions.

Thanks for watching everyone!
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~
Tags: Minimax Algorithm, Game Theory, Tic Tac Toe, Artificial Intelligence, Machine Learning, Python, Software Engineering, Coding
~~~~~~~~~~~~~~~~~~~~~~~~
Рекомендации по теме
Комментарии
Автор

Thank you so much! Iv'e been stuck on the implementation of this algorithm for a while now, and I can't thank you enough for showing me a method that actually works. I subbed btw ❤

arm
Автор

amazing explanation and great code .
i am glad i found the algorithm and found this channel, you found yourself a new sub

amriiheb
Автор

please do more projects related to AI...
Studying AI from an MIT graduate would be very cool and beneficial.
Thank you for your effort!

charlie
Автор

Thanks, I was working on the vanilla minimax algorithm and the AI wasn't able to prioritize the quicker victory, your tip about the utility function helped.

rustyelectron
Автор

Wow thank you for this wonderful tutorial, this is the first implementation of the minimax algorithm that actually worked for me!!!

DJdopeMike
Автор

Thank you for having kindly shared this fantastic implementation and explanation :)

jdeb
Автор

Really great video! Thanks so much for uploading this! Would've been amazing if you could have explained a bit more the whole minimax function :/ I subscribed to your channel now. You have great content

fernandocl
Автор

Great video ! You are helping a lot for my AI class haha ! Keep up the good work Kylie :)

paulaugis
Автор

Thanks alot for inspiring me to learning more and more coding.

neerajmanjhi
Автор

I am currently learning how to code a Tic Tac Toe by using python. Your video giving me such a great inspiration. Can you talk more about how to code the optimal solution by using python?

tonyleung-tooj
Автор

Very good tutorial. I was also wondering how to make a value from the states while going down the tree! I am trying it next!

oscareriksson
Автор

Very Very Amazingly well explained and concept with code implementation is superb !!!

squad
Автор

This video is awesome. I'm a c++ beginner and I want to try to implement this on a sudoku solver

mateoslab
Автор

Great video. However, for user_input the allowable moves should be (0-8), and not (0-9) because there is no 9th position on the board.

willmassey
Автор

Thanks for this -- ready to win all of my tic-tac-toe games now!!!

caitlinkeegan
Автор

Congratulations you earned my subscription 😌❤️

anidea
Автор

HI, i tried, and it works really good with 3x3, but when it comes to 5x5 its not that efficient.. i tried using alpha-beta pruning, but somehow it doesn't work, the AI letting me win, any suggestion?

enzi_r
Автор

Hi I really like the way you explain things in your videos! Would you be able to do more coding tutorials pls?

fay-qpcn
Автор

Hi! Very good explanation! :)
Is there a way to use the same algorithm for more than two players? For example: in turn based RPG when the main character is against two enemies. Is it possible to consider that, for an enemy, the algorithm will have cycles of max-max-min ?

joaopedrooliveira
Автор

can anyone explain me how the code works inside the for loop and the recursion ??? please help me

md.sabbirhossen