Welcome to the Sixteenth of Altitude Foundation’s #MicroChallenges2020
Today we’re exploring ‘best possible solutions’ using Battleship!
What’s a Micro Challenge?
These challenges are short activities to help you develop, revise or refresh your coding skills, posted every Monday, Wednesday and Friday.
Micro Challenge #16
This week, we are exploring ‘best possible solutions’ – finding different solutions to issues and determining which is the best. For our Monday challenge, we are looking at the game Battleship – a classic board game.
It uses a 10 x 10 grid like this:
You will then place your five ships onto the grid. The five different ships can be represented like this (one X represents one set of grid coordinates):
X X X X X
X X X X
X X X
X X X
Your opponent will do the same. The aim of the game is to sink their ships before they sink yours. What system can you use to ensure success most of the time?
Can you create a system which will allow you to identify and sink your opponent’s ships as fast and reliably as possible?
- The size of the ships
- The size of the grid
- What to prioritise: speed or reliability?
How can you prove the effectiveness of your strategy on the grid?
Try it out on this online version of Battleship. This is a larger grid and the ships have a slightly different breakdown – how might that change your strategy?
How might your strategy have to change when you hit a ship? Why?
Could you design a search algorithm which reflects your strategy? (See Challenge 13 and Challenge 14 on searches)
We would love to see what you have created! Please send any pictures, videos, or files of your activities to us – either via Facebook, Twitter or Instagram using #MicroChallenges2020 or to email@example.com. If you are emailing them to us, please let us know if you are happy for us to share your stuff on our social media platforms (with credit, of course).
Sign-up here to receive a weekly email with Micro Challenges top tips and solutions: