|
-
Mar 23rd, 2004, 10:23 PM
#1
Thread Starter
Hyperactive Member
Battleship Search Algorithym
Does anyone know of a good algorithym for the game "Battleship"?
cjqp
When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.
-
Mar 24th, 2004, 01:28 AM
#2
I honestly blanket every other square in a grid when I play, though it does get boring so I usually break from the pattern. Other than complete randomness, you could use some type of grid like above.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 24th, 2004, 04:20 AM
#3
-
Mar 24th, 2004, 11:11 AM
#4
Thread Starter
Hyperactive Member
Hmm, thanks for responding! The method I've used in the past is an X and then filling in the regions most likely to have ships. Unfortunatly, the dang 2x1 ship (forget its name) usually excapes me no matter what I do.
I guess I'll put some methods in (programming the game for a computer assignment) and see which are best 
Thanks,
cjqp
When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.
-
Mar 25th, 2004, 05:17 AM
#5
-
Mar 29th, 2004, 08:11 AM
#6
I find a quick way to find a ship is to start in the centre and work outwards in a spiral, jumping every other square.
Once a hit is scored, check north, east south and west of it and continue in a direction that works. When that direction stops working run back to the start of that line and go in the other direction until the ship sinks.
Always remember the squares you've tried before!
Won every match in a computer algorithm competition last year. :smug: :annoying smirk:
I don't live here any more.
-
Mar 29th, 2004, 11:29 AM
#7
Thread Starter
Hyperactive Member
Thanks wossname! I'm still developing the program's interface (VB has a maximum of like 230 controls on a form, so I'm having to use SetParent API and this has become a little tricky lol), but I'll try your algorithym when I get to that part.
cjqp
When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.
-
Apr 2nd, 2004, 08:11 AM
#8
Why don't you use a grid control? Or create a control array at runtime.
I don't live here any more.
-
Apr 2nd, 2004, 03:39 PM
#9
In my opinion the best way to win battlefield is this:
First try to get the bigest ship, to get this one you only have to check every fourth square (the big one has four squares).
When hitting a ship, destroy it. The smaller the ship you , the better for you.
When all big one are sunk, change to the next smalllest ship (a ship of 3 squares, shoot only every third square). Continue until you have only the 1 square ships left, then you have to shoot at every square.
Of course you store the squares already shot, and you can use some smart search algo's the select the most effective square. Like, if you try to search for a three square ship, and the squares to shoot form an cross, you better shoot the centre, that way you only need one shot.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Apr 4th, 2004, 01:53 PM
#10
Thread Starter
Hyperactive Member
Thanks for the suggestion opus, I'll add it to the list I'll try.
cjqp
When your answer is the Arc Sin of 1.015, you should check your Pythagorean triple.
-
Apr 5th, 2004, 01:04 AM
#11
Frenzied Member
i've heard that bombing in triangles works well..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|