3 ms·
It would be nice to be able to click in any square in the board, instead of just the ones in the bottom.
by gus_massa 4y ago
It would be nice to be able to click in any square in the board, instead of just the ones in the bottom.
- pebcakID10T 4y agoGood idea. Done.
- TedDoesntTalk 4y agoI've thought about winning algorithms for this game before. The best I could come up with is roughly "get the highest locations you can while still defending against 3-in-a-row".
- pebcakID10T 4y agoThe computer AI code is in this file: http://flydaddy.net/games/connect-four/js/computerOpponent.js http://flydaddy.net/games/connect-four/js/computerOpponent.j... Basically when it’s the computer’s turn it evaluates every possible move and assigns an attack and defense value for each move. The attack value is based on how many in a row and whether it can win on next turn, and the defense value is how many opponent’s chips in a row and whether it will lose on opponent’s turn. And if 2 or more moves are equal, favor the move closest to the center of the board.