Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Daryl Carr
18,318 PointsMinimax Algorithm and Tic-Tac-Toe
Hi all.
I am trying to build a tic-tac-toe project in JS with an 'AI' player. After some research I found the minimax algorithm which basically involves creating a program that uses recursion to look ahead at all possible moves both players can make and returns a value so that the AI can evaluate which square to choose. I understand the algorithm itself but I really struggle with how to approach putting that into JS. Has anyone had any experience with this that they could pass to me? Really stuck now!
1 Answer

jcorum
71,828 PointsJust wondering if you have seen this web page: http://mostafa-samir.github.io/Tic-Tac-Toe-AI/
He uses the minimax algorithm.