Welcome back to another Coding Contest. This one is going to be a bit different than the last couple, as it will be more of a competition than the last couple of challenges (similar to the April Maze Contest). There will be a clear winner at the end, and will be based on the performance of your code.
The purpose of this Coding Contest will be to develop an AI (Artificial Intelligence) that can play the game Battleship. I will quickly go over the rules of battleship here:
- The game board is 10x10 squares
- Each player places his ships at the start, there are 5 ships for each player of lengths 2, 2, 3, 4, 5
- Once both players have placed their ships on the board in such a manner that they don't overlap, it is randomly decided who will go first
- Each player takes turns choosing a square to "fire" at, the square they choose is revealed as either a hit or a miss depending on whether an opponents ship was at that location
- If it was a hit that player gets to go again
- The object of the game is to sink all of the opponents ships
All the work of creating the User Interface, and the rest of the game framework has already been done for you. All you have to do is implement a class template that has already been laid out. Download the attached project and fill in the methods in clsEntry that you require for your AI (you probably won't need to use all of them). At a minimum you must implement at least the PlaceShip() and MakeShot() functions. You can place code in the other methods as you see fit. Each method has comments explaining when it is triggered and what the arguments represent. All your code must be contained in the clsEntry class file.
How will you be Judged?
Once all the entries have been collected they will be pitted against each other in a round-robin tournament followed by a single-elimination playoff for the top 4 entries. Each match (in both the round robin and single-elimination) will be a best out of 5 games. This gives the competitors the opportunity to implement an AI that can learn from its opponent and adjust its strategy based on the results of the previous games in the match (this is your decision of course). The AI's will have a limit to the amount of processing time they are allowed. Each AI will be allowed up to 15 minutes of "think time" for the entire best of 5 match. If an AI exceeds this time it will be an automatic match loss for that competitor. The judging will be done on a PIII 733mHz with 256MB of RAM. All methods in the class template receive an argument containing the time remaining in milliseconds before your think time runs out, if you wish you can adjust your strategy as you detect your think time is running low.
Included with the project is a sample AI implemented in the class clsRandom. It is a very "dumb" AI and just randomly chooses where to place its ships, and where to fire each turn. It is sufficient to demonstrate to you how to implement a barebones AI and it can be used to test your entries against.
When you run the project and hit the Start button it will run a best of 5 match between the class clsEntry (which you have to implement) and the class clsRandom. Note: If you try to run the project without writing any code in clsEntry it will give you a runtime error.
Who Can Enter? and How?
Any registered member of visualbasicforum.com is allowed to enter, including badged members (experts, gurus, leaders, mods, admins), however only the top 4 entries from non-badged members will advance to the single-elimination playoffs. Each user is allowed to enter as many entries as they wish, but you are encouraged to only enter 1 class that is the best out of all the ones you create. To submit your entries email them to email@example.com
. The deadline for submitting entries will be 11:59pm (Central Standard Time) on August 9, 2003. During the period from now until the contest has closed, no discussion of techniques or algorithms used to complete the task will be allowed either on the forum or on IRC. Do NOT
post your entry publically. When submitting your entry attach just the clsEntry class file, and include your username on the forum so I know who you are. Any submissions that do not compile and run without errors will be disqualified. This contest is meant to be coded in Visual Basic 6, if you can get the project to work for you in VB5 (or VB4) then feel free to write an entry and send me your class file, so long as the class file will compile and run in my version of VB (VB6) it will be entered.
What does the winner receive?
The satisfaction of winning, the respect of their peers, and a custom title and badge.
If you have any questions ask them in the official contest thread at http://www.xtremevbtalk.com/show...threadid=89847
[Here is the updated ZIP file]