Here are some suggestions of strategies to improve your bots performance.

## Randomise your ships

There are many different ways to arrange your ships at the start of a game. If you choose the same locations every time, your opponent will soon realise and start guessing accordingly. One strategy is to randomly place your ships each game, this is a massive improvement. (But still isn't perfect) You can use the inbuilt helper function, deployRandomly() to achieve this. See if you can think of a better solution though.

## Randomise your shots

In most of our game styles there are dozens of possible cells to fire at, if you follow a pattern to determine where to fire next your opponent may be able to place his ships to avoid your guesses. Add some randomness to your shots to prevent this exploit. Use the chooseRandomValidTarget() helper function if you want completely random shots, however this on its own is not a good strategy either.

## Model your opponent's board

What are the opponentâ€™s ship positions likely to be, based on probabilities and history?

The probability of a randomly placed ship being in a certain position on the board isn't the same for all locations. Calculate the probability distribution of ships appearing in each location and you will be able to make more educated guesses. Some positions may never be able to hold a ship, so don't waste your time guessing there!

To improve your guesses even further try remembering your opponents and where they placed their ships. You might be able to discern a pattern! For example at the end of each game you could record your opponent's name and the locations of their ships (assuming you know where they are) and using this you could construct a table of probabilities describing the likelihood of each player placing their ships in given locations. Maybe one of your opponent's regularly places his ships on the edges of the board, if you recognise this you could immediately start guessing the edges of the board first next time you play against them. See the case study talking about this on our Adding Intelligence To Your Bot page.

## Reduce unnecessary moves

There are plenty of techniques to reduce the maximum number of moves needed to finish a game of battleships. Some are obvious, like guessing near the location of a hit for the rest of the ship or not guessing in a location where a ship wouldn't be able to fit, others are less obvious. See if you can implement them all.