Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI
Coding Contest - Battleship AI Coding Contest - Battleship AI
Coding Contest - Battleship AI
Go Back  Xtreme Visual Basic Talk > > > Coding Contest - Battleship AI


Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2003, 09:40 PM
Optikal's Avatar
OptikalCoding Contest - Battleship AI Optikal is offline
Codeaholic

Retired Leader
* Guru *
 
Join Date: Oct 2002
Location: Winnipeg, MB, Canada
Posts: 4,543
Default Coding Contest - Battleship AI


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 battleship@visualbasicforum.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]
Attached Files
File Type: zip BShipFramework.zip (11.1 KB, 519 views)
__________________
There are 10 types of people in this world, those that understand binary, and those that don't.

Last edited by Squirm; 07-13-2003 at 04:43 PM. Reason: Added Optikal's new ZIP file
Reply With Quote
  #2  
Old 08-10-2003, 11:18 PM
Optikal's Avatar
OptikalCoding Contest - Battleship AI Optikal is offline
Codeaholic

Retired Leader
* Guru *
 
Join Date: Oct 2002
Location: Winnipeg, MB, Canada
Posts: 4,543
Default Coding Contest Questions (Battleship AI)

Well, the contest is now over. Congratulations to all that entered. There were some very interesting entries submitted, hopefully you all take the time to look over the code of the competitors.

Congratulations to our winner, BlackEye!

The results from the Round Robin are:

Optikal (15-3)
BlackEye (15-3)
Mikael1 (15-3)
Bozze (14-4)
Bpd (13-5)
Bucky7 (12-6)
Zone-MR (11-7)
Mikael2 (10-8)
Otac0n3 (10-8)
Martrinex (10-8)
MarcoChaney (9-9)
Otac0n1 (9-9)
Robse (9-9)
Otac0n2 (7-11)
Polo (6-12)
WRBennett (3-15)
TypingMonkey (2-16)
GavinO (1-17)
Richy2k (0-18)

BlackEye, Mikael1, Bozze and Bpd advanced to the final four playoffs. The results of this were:

BlackEye vs Bpd - BlackEye Wins (3-1)
Mikael vs Bozze - Mikael Wins (3-0)

BlackEye vs Mikael - BlackEye Wins (3-0)

The complete results of the round robin matches can be downloaded in the attached Excel spreadsheet. All the entries are also attached.
Attached Files
File Type: zip RoundRobinResults.zip (5.0 KB, 135 views)
File Type: zip Entries.zip (84.7 KB, 354 views)
__________________
There are 10 types of people in this world, those that understand binary, and those that don't.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding Contest #5 - Mazes Squirm Tech Discussions 165 04-01-2003 01:37 PM
Other Coding Contest brillo Tech Discussions 1 03-18-2003 04:24 PM
Coding Contest #1 BillSoo General 49 07-09-2001 02:03 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI Coding Contest - Battleship AI
Coding Contest - Battleship AI
Coding Contest - Battleship AI
 
Coding Contest - Battleship AI
Coding Contest - Battleship AI
 
-->