Battleships—A Search Game using Hashing
Instructions
1. Each take a sheet as in the previous games and tell your partner the number of your
chosen ship.
2. In this game you can find out which column (0 to 9) the ship is in. You simply add
together the digits of the ship’s number. The last digit of the sum is the column the ship is
in. For example, to locate a ship numbered 2345, add the digits 2+3+4+5, giving 14. The
last digit of the sum is 4, so that ship must be in column 4. Once you know the column
you need to guess which of the ships in that column is the desired one. This technique is
called ‘hashing’, because the digits are being squashed up (“hashed”) together.
3. Now play the game using this new searching strategy. You may like to play more than
one game using the same sheet—just choose from different columns.
(Note that, unlike the other games, the spare sheets 3A' and 3B' must be used as a pair,
because the pattern of ships in columns must correspond.)
Follow Up Discussion
1. Collect and discuss scores as before.
2. Which ships are very quick to find? (The ones that are alone in their column.) Which
ships may be harder to find? (The ones whose columns contain lots of other ships.)
3. Which of the three searching processes is fastest? Why?
What are the advantages of each of the three different ways of searching? (The second
strategy is faster than the first, but the first one doesn’t require the ships to be sorted into
order. The third strategy is usually faster than the other two, but it is possible, by chance,
for it to be very slow. In the worst case, if all the ships end up in the same column, it is
just as slow as the first strategy.)