top | item 33281916

Play against the computer – Connect Four game in JavaScript

25 points| pebcakID10T | 3 years ago |flydaddy.net | reply

24 comments

order
[+] i13e|3 years ago|reply
ICYI Connect Four is a solved game, you can read about it here: https://en.wikipedia.org/wiki/Connect_Four#Mathematical_solu...
[+] pebcakID10T|3 years ago|reply
Yes, I may do a minimax version with a difficulty setting. That would be fun to do.
[+] Pxtl|3 years ago|reply
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.
[+] pebcakID10T|3 years ago|reply
Should be fixed now - an off by one error checking diagonals that hit the top of the board. Thanks!
[+] pebcakID10T|3 years ago|reply
Yes, I need a bug report button.
[+] gus_massa|3 years ago|reply
It would be nice to be able to click in any square in the board, instead of just the ones in the bottom.
[+] pebcakID10T|3 years ago|reply
Just a fun little project I did. It's beatable, but not easy.
[+] duderific|3 years ago|reply
It seems like going first is a disadvantage, since the AI can just play defensively until you are backed into a corner.
[+] POiNTx|3 years ago|reply
How good is the AI and how was it made?
[+] pipeline_peak|3 years ago|reply
The best trick I can think of is to reach a point where you can get connect four in two or more places and the bot can only cancel out one.