# DutLUG

Highlighted

## Battleships! - DutLUG Coding Competition

Update! We've got a winner!

Battleships winner Stefan Lemmens receiving his price! Congratulations!

Stefan Lemmens won the first DutLUG coding challenge! Well done Stefan and congratulations!

Attached to this topic you will find the solutions code of all entries, the maps, scoretabel and tournament version of the Battleships Coding Challenge, conveniently in one zip file. The binary map files can be unflattened from string to a maps class object, so you can analyse in full detail what happened during the tournament.

Thank you everyone!

Cheers,

Pascal

Win a bol.com giftcard worth €50,-!

www.bol.com

Our first ever DutLUG LabVIEW competition is being held during our DutLUG meeting on 17-05-2018, where you could win a giftcard from bol.com, the leading webshop in the Netherlands for books, toys and electronics.

And you have a chance at winning this awesome prize, all you need to do is solve the following LabVIEW challenge!

The Challenge - Classic Battleships!

Download the attached Battleships simulation game, open Battleships_Main.vi and run it. Recognise it? Great! Open the block diagram and locate “Your VI Here” - this is the smart bit that decides where to fire the salvos. The challenge is to create your own solution for solving the grid in as few a moves as possible! The included “Your VI Here” uses random coordinates, which isn’t smart, so replace the block diagram with the best solution you can!

During the DutLUG we’ll pitch all your submissions against each other, to determine who can sink all ships with the least amount of shots. The winner will receive the giftcard prize!

The Rules

1. You need to be a member of this DutLUG Community group to participate.
2. You need to be attending the DutLUG meeting on 17-05-2018 in Eindhoven to claim the prize. If the top ranking player is not at the meeting, the price goes to the next attending player.
3. Don’t change the name of “Your_VI_Here.vi” - if you change it we won’t find it! Just replace the block diagram with your code, keeping the indicators and connector pane the same.
4. No cheating please by searching for the grid inside the host! Let’s honour the spirit of the game and keep it fun!
5. Keep your code unlocked. No password protection or removal of block diagrams, we only want to inspect your code to ensure no-one’s cheating. We won’t steal it.
6. Your algorithm must take less than 1 second for each move. This is to keep the total gameplay time down.
7. Use pure LabVIEW. No DLLs or .NET under the hood.
8. Save your submission in LV2015, LV2016 or LV2017.
9. Submit your solutions to pascal@vi-tech.nl as a zip file, and include your name in the message somewhere (and anything else you want us to know about you).
10. Submit your entry before Wednesday 16-05-2018 at the latest.

We won’t reveal anyone’s code, so don’t worry about keeping it tidy. And with your submission make sure you include all your dependencies - we just might not have that special AI function you’re relying on 😉

Any questions, post them here and we’ll do our best to answer them. And Best of Luck Everyone!

Message 1 of 19
(3,444 Views)
18 REPLIES 18
Highlighted

## Re: Battleships! - DutLUG Coding Competition

Nice competition, maybe I'll give it a try but I wonder what the game rules are before starting? Because I remember that normally a player is told when a complete ship is sunk. So when you hit both coordinates of the smallest ship (2 blocks), you can eliminate all surroundings of this ship since you get feedback that you sunk a complete ship. Are you allowed to use this feedback? Because if it is allowed, you do need to check some stuff in the host map 😉

And from the code I can tell that collisions in any directions (horizontal vertical and diagonal) are not allowed, but it's good to mention this in the game rules.

Message 2 of 19
(3,402 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

Hi @Brandts

The game will not give you feedback that a ship was sunk, it only returns if the square you shot at was a hit or a miss. Your algorithm needs to figure out if a ship was sunk by itself.

note:

Please don't modify the connector pane of the “Your_VI_Here.vi” vi, as stated in rule 3.

Message 3 of 19
(3,393 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

It has been very quiet here, how are your algorithms al doing? I'm very curious

Wie doet er mee?

Message 4 of 19
(2,593 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

Wordt aan gewerkt. Ik blijf optimaliseren zolang het kan en ik tijd heb.

Message 5 of 19
(2,516 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

Is the winner the player with the least shots in 1 single game, or the the least average shots in a series of game?.

My results often vary +/- 10 shots in 10 games...

Message 6 of 19
(2,452 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

@Peug wrote:

Is the winner the player with the least shots in 1 single game, or the the least average shots in a series of game?.

My results often vary +/- 10 shots in 10 games...

Thank you for your question. The winner will be the one using the least amount of shots on multiple maps in total, so all shots will be added up and the player with the least amount of shots won. Each player will get the exact same set of maps, to remove the random factor. The amount of maps I have not yet determined.

Message 7 of 19
(2,444 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

An average over 1000 games seems to be quite stable. This takes a couple of minutes to calculate which might become a problem if there are a large number of submissions...

Message 8 of 19
(2,373 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

Will the set of maps be random? Or will they be designed specifically to tell apart strong AIs from weak AIs?

Message 9 of 19
(2,367 Views)
Highlighted

## Re: Battleships! - DutLUG Coding Competition

@StefanLemmens wrote:

An average over 1000 games seems to be quite stable. This takes a couple of minutes to calculate which might become a problem if there are a large number of submissions...

I did the same coding challenge during the European CLA summit of 2017. Some algorithms can get really advanced and complex, resulting in execution times of multiple seconds per turn. Hence the rule that a turn may not take longer then 1 second to make sure the tourney does not take too long. There is no code to enforce the 1 second rule, because it is dependent of the hardware running the code. It is meant as a good indication of how "fast" your algorithm should be.

Message 10 of 19
(2,362 Views)
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.