Coding an Unbeatable Tic Tac Toe AI Using Python and the Minimax Algorithm

  Рет қаралды 55,647

Coding Spot

Coding Spot

Күн бұрын

Пікірлер: 82
@jscioo
@jscioo 2 жыл бұрын
Your voice is the only voice that didn't make me go insane after hours of listening. Subscribed!
@codingspot
@codingspot 2 жыл бұрын
Happy to hear that my friend!
@TriStateRailfannerJL99963
@TriStateRailfannerJL99963 2 жыл бұрын
One of the BEST project tutorials EVER. Thank you. This was awesome.
@jugujogurt4300
@jugujogurt4300 3 жыл бұрын
Thanks you very much for making this!! I have been waiting long for a good tic tac toe ai tutorial and this is perfekt!!
@codingspot
@codingspot 3 жыл бұрын
Hope you like it!
@masternobody1896
@masternobody1896 3 жыл бұрын
@@codingspot thanks
@GrowWithArup23
@GrowWithArup23 8 ай бұрын
@@codingspot How to make "ai vs ai" mode? kindly help!!
@anushriiii08
@anushriiii08 2 жыл бұрын
Thank you so much for this tutorial ! Very useful tbh ! Got to learn a lot. Please keep making these!
@Yashwanth_211
@Yashwanth_211 4 ай бұрын
Beautifully done man ! Keep up the good work
@anonymuz9575
@anonymuz9575 2 жыл бұрын
You're so good at explaining things man! Mark my words: this man will blow up one day
@ATGG
@ATGG 3 жыл бұрын
Welcome back man! Hope you good!
@codingspot
@codingspot 3 жыл бұрын
Hey bro!! Doing great thanks!
@TheWrekerVids
@TheWrekerVids 2 ай бұрын
The thing about this: Once you get good enough at Tic Tac Toe to the point that you always draw with this AI, you will NEVER lose again. Speaking from experience
@sergiogarzonmarino9878
@sergiogarzonmarino9878 2 жыл бұрын
Wow brother, this is the most clear tutorial that I could find. Thank you so much! Keeing up!
@chrismai48
@chrismai48 8 ай бұрын
I understand everything except the AI minmax method coding and unfortunately that was the reason that i watch your video. Never the less i think you 've done a pretty good job...
@shalinisaini3787
@shalinisaini3787 12 күн бұрын
Thank you for this amazing tutorial
@lalaissosoft
@lalaissosoft 2 жыл бұрын
seriously best tutorial ever. Thank u for your amazing work
@pedroliedu4257
@pedroliedu4257 2 жыл бұрын
Thank you very much! Great tutorial video, helped me a lot! Many thanks again!
@builtbydhruv
@builtbydhruv 8 ай бұрын
Well thanks brother , this is amazing .
@bluidguy4007
@bluidguy4007 Жыл бұрын
I'm at: Time: @1:38:30 I copied the code as you did it and I am getting the same result as you EXCEPT on the print out, for some reason it is showing 0 when the eval should be -1 because it knows it's going to win, any idea what I did wrong?
@romanizzo3412
@romanizzo3412 2 жыл бұрын
Best tutorial out there. Thanks
@thenonhuman9593
@thenonhuman9593 3 күн бұрын
Im stuck on the resursion thing
@akhiltamgaonkar23
@akhiltamgaonkar23 Жыл бұрын
Hello ..I am getting an error offset is not defined.. Would you please tell me how do I fix it
@daniel173880
@daniel173880 3 жыл бұрын
This is so good!!! Thank you!!
@codingspot
@codingspot 3 жыл бұрын
Happy to hear that my bro!
@mohithrajds8852
@mohithrajds8852 Жыл бұрын
brother where i can get code@@codingspot
@laasd1613
@laasd1613 Жыл бұрын
What's the alternative way to write the code at 49:22?
@rajnigupta8581
@rajnigupta8581 2 жыл бұрын
Hey, can you help me out ? A bit urgent, I'm trying to implement a similar (4*4 tic tac toe) but getting an error here!
@codingspot
@codingspot 2 жыл бұрын
Can you paste the error to see it
@rajnigupta8581
@rajnigupta8581 2 жыл бұрын
@@codingspot It goes into infinite loop and throws an error on board not responding...Would you mind telling me a mode where I can share pic?
@codingspot
@codingspot 2 жыл бұрын
You can send me it through Instagram
@sanghoaxuan2028
@sanghoaxuan2028 Жыл бұрын
Have you fixed this error yet ?
@nishthasharma3161
@nishthasharma3161 10 ай бұрын
Hlo can u please tell me how to solve some error. Width is not defined
@ThePackLeaderWolfe
@ThePackLeaderWolfe 2 жыл бұрын
Hey would it be possible to implement this Ai into the tic tac toe game made with your previous tutorial?
@codingspot
@codingspot 2 жыл бұрын
Sure, I did it this way because I think is much easier, but you can do it without classes and objects too
@ThePackLeaderWolfe
@ThePackLeaderWolfe 2 жыл бұрын
@@codingspot Would it be possible for you to write out small sample code without objects and classes so i can get an idea of how i'd implement it into the old noughts and crosses python tutorial
@majdalotaibi5510
@majdalotaibi5510 2 жыл бұрын
I have a question , I used ur code to my AI course and I need to make sure of something, how can I communicate with you please help me
@GrowWithArup23
@GrowWithArup23 8 ай бұрын
How to make "ai vs ai" mode? kindly help!!
@ChocoAnime465
@ChocoAnime465 Жыл бұрын
For some reason when the AI starts and my first move is in the centre, I will always win. Why's that?
@sheafsmash142
@sheafsmash142 Жыл бұрын
Does anyone know the Color Theme that he uses? I liked the colors of the variables in the code @Coding Spot
@ajsingh3100
@ajsingh3100 3 жыл бұрын
are this video and that tic tac toe video which have 5 parts same? which video should i watch first? and can i use sublime text ?
@codingspot
@codingspot 2 жыл бұрын
Hey! They are not the same, the one with 5 parts is the clasic player vs player tic tac toe game (easier). In this one you will add a computer to play against (harder).
@codingspot
@codingspot 2 жыл бұрын
And sure you can use SublimeText or any other text editor, just make sure to have pygame installed.
@ajsingh3100
@ajsingh3100 2 жыл бұрын
@@codingspot thank you so much
@rebhuroy3713
@rebhuroy3713 2 жыл бұрын
Hey thanks for preparing this video... I have coded it in Java but found in some corner cases it doesn't work.. can you help me to identify the issue
@محمدحجازي-د2ت
@محمدحجازي-د2ت Жыл бұрын
can u make the same project with android syudio?
@abderrahmanegorram
@abderrahmanegorram Жыл бұрын
i have an error in the move variable
@MrWhiteGorilla98
@MrWhiteGorilla98 2 жыл бұрын
I follow the tutorial i get a good result but it can be beatable somehow if I start playing in some pos the ai doesn't mark the smart position I think its kinda see the fast move not the best move hope u understand me thanks
@0Jozo
@0Jozo Жыл бұрын
can u add a score board with it
@DancewithChhavi20
@DancewithChhavi20 2 жыл бұрын
half part was same in you older pvp series parts
@peace336-n8g
@peace336-n8g Жыл бұрын
Can I ask basic question, why non maximising is ai player ? Can maximising be ai player?
@xxtbge0457
@xxtbge0457 3 жыл бұрын
May i please ask that can i learn this if im like between intermediate and beginner ?
@codingspot
@codingspot 3 жыл бұрын
Sure you can, I tried to make it beginner friendly. But you can also start with the normal tic tac toe tutorial which is easier.
@xxtbge0457
@xxtbge0457 3 жыл бұрын
@@codingspot oh ok thanks:>>
@adityakangune770
@adityakangune770 2 жыл бұрын
Thank you!
@renielmanalo7282
@renielmanalo7282 2 жыл бұрын
it doesn't work and it says error because of "numpy" what should I do?
@codingspot
@codingspot 2 жыл бұрын
Make sure you have numpy installed
@renielmanalo7282
@renielmanalo7282 2 жыл бұрын
@@codingspot nice! but one last question, how do you change the O and X to S and O? because we have a project and we need to change it to a SOS game but works like a TICTACTOE game. hope you can help
@codingspot
@codingspot 2 жыл бұрын
You will need to change the method that draws the figures. Instead of drawing an 'X', you should draw an 'S' (try drawing it like the number 5 with 5 lines), the 'O' will be the same in your case.
@wabhou
@wabhou 2 жыл бұрын
thanks a lot for this video
@oumaimadguigou9882
@oumaimadguigou9882 2 жыл бұрын
I don't know why in the 26 minute the compilation shows up but once i click on the screen it disappears
@codingspot
@codingspot 2 жыл бұрын
Is there any error showing up?
@oumaimadguigou9882
@oumaimadguigou9882 2 жыл бұрын
It's oky I juste make an error Thank you so much for your efforts
@umutokcurmr
@umutokcurmr Жыл бұрын
where can i get the codes
@namphan9317
@namphan9317 2 жыл бұрын
I tried to code based on your idea and found that if I let the AI goes first, specifically at grid (1, 1), there might be a chance that the AI doesn't win immediately. I wonder if you could try that on yourself and see if this is only my problem or because of how the mechanism of minimax work :D anyways, thanks for your help, I was able to finish my school's lab.
@brand_blitz
@brand_blitz Жыл бұрын
same issue
@nguyenthaihoc5192
@nguyenthaihoc5192 Жыл бұрын
can 4x4?
@WebDevXpert
@WebDevXpert 8 ай бұрын
Tic Tac Toe Game in JavaScript | JS Project Day 1 | JavaScript Full Course : kzbin.info/www/bejne/goKcapuEhpKfsK8
@weirdfactsfromluka
@weirdfactsfromluka 2 жыл бұрын
can you copy the code in here?have a great day!!!
@codingspot
@codingspot 2 жыл бұрын
Code is too long to paste it here, but you can find it on my github (link on description)
@mohithrajds8852
@mohithrajds8852 Жыл бұрын
brother it is not opening @@codingspot
@sachinjain6913
@sachinjain6913 Жыл бұрын
Shouldn't O be maximizing? Because it moves first????, Is it because we return -1 for the first player, Alright, Got it , great tutorial!
@merarebbadro9328
@merarebbadro9328 2 жыл бұрын
Please add the translation
@mohithrajds8852
@mohithrajds8852 Жыл бұрын
hello any one can send code of tic tac game
@armyegymox5530
@armyegymox5530 2 жыл бұрын
hi why no massage for who when
@ajsingh3100
@ajsingh3100 3 жыл бұрын
please i need your help!!
@pantanlp7187
@pantanlp7187 2 жыл бұрын
there is a problem with when the ai is starting... i mean the best possible move is to place it in the center cause its not necessarily a draw then cause the human player can still mess up but i mean the same counts for what its doing right now of course but the chances of winning are much better when starting in the center at least in a human sense.
@OmarParyad-oi6um
@OmarParyad-oi6um 8 ай бұрын
Please Active Subtitle I'm From Iran
@FR4NKTUB3
@FR4NKTUB3 7 ай бұрын
It's not AI tho
@aaaaaaa-b9sguy
@aaaaaaa-b9sguy Жыл бұрын
well i beat it
@adrieladegunju
@adrieladegunju 3 ай бұрын
sorry for the comment it was for another nonsense video
@adrieladegunju
@adrieladegunju 3 ай бұрын
nonsense
Minimax: How Computers Play Games
14:37
Spanning Tree
Рет қаралды 217 М.
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Algorithms Explained - minimax and alpha-beta pruning
11:01
Sebastian Lague
Рет қаралды 1,1 МЛН
Coding a Complete Chess Game AI With Python (Part 1) | PVP Game Mode
5:37:17
Can You Beat Minecraft From One Grass Block?
35:27
Beppo
Рет қаралды 6 МЛН
Minimax Algorithm for Tic Tac Toe (Coding Challenge 154)
26:33
The Coding Train
Рет қаралды 826 М.
Making a Game With C++ and SDL2
8:14
PolyMars
Рет қаралды 1,7 МЛН
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 204 М.
I made an unbeatable Tic Tac Toe AI (Minimax algorithm)
9:19
nextProgram
Рет қаралды 134 М.
Much bigger simulation, AIs learn Phalanx
29:13
Pezzza's Work
Рет қаралды 2,8 МЛН
I made maps that show time instead of space
10:44
Václav Volhejn
Рет қаралды 1,1 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН