Coding Challenge 154: Minimax Algorithm for Tic Tac Toe

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Ā Drawing...Ā Ā  šŸŽ„ Next video:    • CodingĀ ChallengeĀ #155:Ā KaleidoscopeĀ Snowfl...Ā Ā  šŸŽ„ 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Ā alpha-b...Ā Ā  šŸ”“ Livestream Archive:    • CodingĀ TrainĀ LiveĀ 188:Ā Ā TicĀ TacĀ ToeĀ AIĀ wit...Ā Ā  Related Coding Challenges: šŸš‚ #94 2048 Sliding Puzzle Game:    • CodingĀ ChallengeĀ #94:Ā 2048Ā -Ā PartĀ 1Ā Ā  šŸš‚ #149 Tic Tac Toe:    • CodingĀ ChallengeĀ 149:Ā TicĀ TacĀ ToeĀ Ā  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