finally found time to complete it. the design is pretty basic, but if i didn’t make any mistakes it shouldn’t be possible to beat it and if you let it go first it has a couple of nasty surprises (i remembered tic tac toe meta and it’s very limited what you can do if you go second if you don’t want to lose) https://codepen.io/ead/full/OzKKxy
p.s. i didn’t do that vs another player part since user stories don’t demand it and it’s not any interesting to make it, i dunno why it’s included in the example app
I have a very simple web design, most of my time was spent on implementing minimax algorithm (it recursively finds the move that maximises the computer odds of winning). Best suitable for hard mode except I didn’t make create easy and hard mode. When I’m done with front end I might go back and improve it.
Thanks for replying. It take a few seconds because the computer recursively checks which move will lead to the best outcome. The minimax algorithm runs the game and take turns to be the AI and user, while testing all possible moves available. Therefore it lags a little.
One of my future improvements include creating a easy mode with hard-coded AI moves, that makes it easier for human player to win. This algorithm is more suitable for hard mode, as it’s almost impossible to win against unless I were to tweak it.
Hi everyone - I definitely got a lot of inspiration from this thread. Now don’t hesitate to shoot if my implementation isn’t up to par. https://user883311.github.io/tic-tac-toe/
I think this is the best result I’ve gotten so far with a FCC project and took the longest for sure. I’m pretty sure it’s unbeatable. My first vanilla JS project. Tic Tac Toe…can you beat it?
Note that I’m closing this thread. It’s much easier to get feedback if you create your own individual post requesting feedback for your own specific project.