Drop Four is a "Connect Four" clone written in C++. Supports a text interface and a graphical interface through wxWidgets.
Drop Four works very well on Linux, Macintosh, and Windows platforms.
This project began seven years ago, but I am just now releasing the source code to the world. It's a relatively simple exercise in Artificial Intelligence and games development. Although I once created a Windows version using graphics primitives, I would like to create a version that uses wxWidgets for cross-platform development. For this end, I will need fellow developers who are capable with graphic design (sprites for the pieces and an image of the board are a minimum requirement) and, possibly, familiar with wxWidgets. Even if nobody else does programming (an undesirable state of affairs), I will need a little help with graphics. Even better would be to find someone familiar with wxWidgets.
The target is to produce executables and packages for the popular operating systems of Mac OS X, Windows 32-bit, and Linux. This is not to exclude also creating versions for your favorite computer, handheld device, game console, or any other platform. These will be developed (especially a Palm version) after a good game is created for the aforementioned three operating systems.
Peter Kirby, the admin of the project, is familiar with C++, passingly familiar with game AI, and starting to learn wxWidgets. The code has been reviewed to attempt a consistent style, in such respects as naming variables, in order to make it most easily readable by other programmers. To maintain this objective, please observe the style of the board.cpp source code in your own contributions.
The following notice is present in the dropfour-text.cpp file:
This is written in C++. I wrote a previous version in QBasic, but it was on the slow side at higher difficulty levels. This is an attempt to optimize the Artificial Intelligence of the program. The graphics are non-existent at this point and could certainly be added. The interface functions can be changed (in ioface.cpp) without any change to board.cpp.
Well, I did create a graphical GUI using the Windows API functions; however, I am not satisfied with having a Windows-only program. Therefore this program will be designed to use wxWidgets. The text interface is primarily for those wishing to test out the AI while the wxWidgets GUI is being developed. The files board.cpp and board.h *must* remain exactly the same in both the text version and the graphical version.
To avoid long lines, use tabs width 4 or less; however, the tabbing should be consistent at any width. A sort of Hungarian is used to indicate what the variables do (whether they are arrays, or indexes, and so on).
Detailed notes on the algorithm and the optimizations achieved can be found in the board.cpp file. Knowledge of the "minimax" algorithm and "alpha-beta" pruning will make it more comprehensible. The only further optimization that I foresee may be a kind of hash table to prevent recalculating potential moves already examined. This may not be necessary for modern CPU's, but it could help when porting to an underpowered handheld device, if that is ever done.