Connect 4 including AI
- System Requirements / Performance info
- Source Info and implementation details
- Download Connect4 Game and Java Source Code
Everybody knows it, everybody loves it: Connect 4. Place your stones so that they connect in a row of 4 pieces diagonally, horizontally or vertically and win.
You hate “4-In-A-Row” – the Connect4 game that e.g. comes per default with ubuntu – because even on the easiest setting it always beats you? Download this game! Its AI makes thoughtful but not too hard moves, it will feel like playing against an actual human being – that’s just a little worse than you are ;) It is also possible to play against another human being. The second player uses right-click to place.
Java must be installed, other than that, there should not be any problem running this game.
The source code is open and contained in the zip files.
The mvc structure is enforced where feasible. At some points the structure is a little weak, this is mainly because it is a university project and every week there where new tasks (but none included – or made time for – making any diagrams or the like).
The current gui is implemented with java swing.
The ai is implemented using the MiniMax-Algorithm (because it is a university project; in the future I might change it to the more efficient alpha-beta algorithm). This was my first implementation, and there are still some mistakes in it. If you would only download the game to see the implementation i would recommend downloading mill with alpha-beta pruning, as the code is nicer and the implementation better (also, it uses alpha-beta).
Thanks go out to fiv who developed this game with me. He is responsible for the graphics as well as large parts of the game logic implementation.