Ran into bug - AI beat me by creating a diagonal with the piece in the top rank and it did not count that as endgame. I was able to keep playing.
Play against the computer – Connect Four game in JavaScript
21–26 of 26 posts
Re: Play against the computer – Connect Four game in JavaScript
#22ICYI Connect Four is a solved game, you can read about it here: https://en.wikipedia.org/wiki/Connect_Four#Mathematical_solu...
Yes, I may do a minimax version with a difficulty setting. That would be fun to do.
Re: Play against the computer – Connect Four game in JavaScript
#23Earlier quoted context omitted.
It seems like going first is a disadvantage, since the AI can just play defensively until you are backed into a corner.
I've found that the only way to win is to go first, just like in tic tac toe. Going second can produce a draw at best, against an optimal opponent. This is just my experience though, not a strong assertion.
Re: Play against the computer – Connect Four game in JavaScript
#24Re: Play against the computer – Connect Four game in JavaScript
#25ICYI Connect Four is a solved game, you can read about it here: https://en.wikipedia.org/wiki/Connect_Four#Mathematical_solu...
Re: Play against the computer – Connect Four game in JavaScript
#26Thanks for sharing! This sent me down the solvability path. It would be cool to have an ‘expert’ mode that plays the optimal strategy.