Connect 4
More
Connect 4 with logic:
The point of the exercise was not to find the most effective way to play a game with all possible moves and select the best winner, that's pretty easy. All it requires is to sequentially select each player and computer moves until the computer wins. Boring.
What I attempted here was to emulate my approach to playing the game using binary masking. For the most part it went exceedingly well and required only a minimal logic engine. But the game itself caused a flaw in my logic which took far too many lines of code to deal with. And as a result, glitches have appeared in the logic.
However, the computer plays a reasonably smart game even though it is ceaselessly predictable.
Colin Fiat Sept 2011