Minimax Algorithm for Tic Tac Toe (Coding Challenge 154)

Published: 11 December 2019
on channel: The Coding Train
811,253
15k

In this challenge I take the Tic Tac Toe game from coding challenge #149 and add an AI opponent for a human player by implenenting the Minimax algorithm. Code: https://thecodingtrain.com/challenges...

🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/s...

🎥 Previous video:    • Coding Challenge #153: Interactive Dr...  
🎥 Next video:    • Coding Challenge #155: Kaleidoscope S...  
🎥 All videos:    • Coding Challenges  

References:
🔗 Geeks for Geeks - Minimax Algorithm in Game Theory: https://www.geeksforgeeks.org/minimax...
📚 Minimax on Wikipedia: https://en.wikipedia.org/wiki/Minimax

Videos:
🏗 Algorithms Explained - minimax and alpha-beta pruning:    • Algorithms Explained – minimax and al...  
🔴 Livestream Archive:    • Coding Train Live 188:  Tic Tac Toe A...  

Related Coding Challenges:
🚂 #94 2048 Sliding Puzzle Game:    • Coding Challenge #94: 2048 - Part 1  
🚂 #149 Tic Tac Toe:    • Tic Tac Toe in p5.js (Coding Challeng...  

Timestamps:
0:00 Introduction to the challenge
2:17 Explanation of the Minimax algorithm
8:20 Start Coding
12:54 Check to see if anybody won
14:16 Recursively check the max score for all the spots (AI)
16:51 Recursively check the min score for all the spots (Human)
18:15 Refactor using min() and max()
19:05 Fix bugs
21:13 Final output
22:46 Ideas and Suggestions

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

🚂 Website: http://thecodingtrain.com/
👾 Share Your Creation! https://thecodingtrain.com/guides/pas...
🚩 Suggest Topics: https://github.com/CodingTrain/Sugges...
💡 GitHub: https://github.com/CodingTrain
💬 Discord:   / discord  
💖 Membership: http://youtube.com/thecodingtrain/join
🛒 Store: https://standard.tv/codingtrain
🖋️ Twitter:   / thecodingtrain  
📸 Instagram:   / the.coding.train  

🎥 Coding Challenges:    • Coding Challenges  
🎥 Intro to Programming:    • Start learning here!  

🔗 p5.js: https://p5js.org
🔗 p5.js Web Editor: https://editor.p5js.org/
🔗 Processing: https://processing.org

📄 Code of Conduct: https://github.com/CodingTrain/Code-o...

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod...

#beginners #tictactoe #minimaxalgorithm #games #p5js #javascript


On this page of the site you can watch the video online Minimax Algorithm for Tic Tac Toe (Coding Challenge 154) with a duration of hours minute second in good quality, which was uploaded by the user The Coding Train 11 December 2019, share the link with friends and acquaintances, this video has already been watched 811,253 times on youtube and it was liked by 15 thousand viewers. Enjoy your viewing!