Excel Chess
A few years ago, my friend Tom and I made a gentleman's bet about who could write a better chess playing program. While he is the superior programmer and a computer expert, I'm the better chess player and have read more about chess-playing algorithms. Neither of us has taken the bet too seriously. Although I've always planned on completing a program, it wasn't until recently that I've had much time to work on it.
I decided early on that I would write my program in VBA (Microsoft Excel's macro-writing language). There are a few good reasons for this and some drawbacks. First, VBA is the only development language that I am familiar with. I didn't want to have to learn another language AND complete the huge task of writing a chess playing program with it. Second, based on previous VBA experience, I knew it would at least be possible to write the chess logic in VBA. Third, I knew that the VBA user interface forms would be easy to couple with the logic.
Another advantage of using VBA is that the code could be easily converted to a more efficient language later because I would only be using basic programming concepts. In retrospect, it is also nice that the program can be distributed as one file and simply placed in the Recycle Bin when the user is done with it.
One drawback is that Excel is not noted for its computational speed. Another drawback is that I'm unsure Excel can keep track of more than a few future moves (required for intelligent tactics to be implemented).
After a lot of work, I've completed Shallow Bot 1.0. While it knows all of the legal moves for a given position, it is only smart enough to make a random move. I hope to improve on this in the future. Given that Excel is known more for its user interface than speed of computation, I don't ever expect Shallow Bot to be that good. If I can make it good enough that it can beat me regularly, I'll be happy with it.
"Shallow" is a play on a number of great programs with "Deep" in their names. You can't get less deep than random moves. I didn't say it was an interesting story...
Download Shallow Bot 1.0
Shallow Bot is a free Excel chess macro. I wrote this program from scratch, but for those wary of downloading an Excel file containing macros from an unknown website, I've also posted it at download.com. All users and distributors agree to the GNU GPL license found in the downloaded file.
Download Shallow Bot 1.0:
unzipped - 475 KB
zipped - 139 KB
Download Shallow Bot 1.0 at download.com:
When opening the file after the download is complete, a "Security Warning" screen may pop up. If so, the "Enable Macros" option must be selected for the program to run. Never enable macros if you do not trust the source of the file! Also note that the program will not run in any browser. It must be downloaded to your hard drive.
There is a "Help" sheet that explains what each sheet in the workbook does. Game play begins on the Data sheet when the user presses the Start button. Human moves are made by clicking on a square containing their piece and then clicking on the square they want to move the piece to. While a human could learn to play by guessing moves and checking them, it helps to know the rules because there is no "teach mode" for beginners.
Development
Shallow Bot 1.0 was developed and tested using Microsoft Excel 2003 on Windows XP. I suspect it will work with other versions of Excel, but I have not tested it. If you find any bugs, I'd love to hear about them so they can be fixed. The code is fairly well commented, so check it out. If you make any changes or updates to the code, I'd be interested to know what you've done. My email address is jollierme@gmail.com.
There are a number of features I would still like to add to Shallow Bot:
- Future move finder.
- Intelligence modules. Middle game then end game and opening book.
- Graphics that look more like standard pieces.
- Last move indicator.
- Improved theoretical draw checker.
- Three repeated position draw rule.
- Fifty move rule.
- Time considerations.