Guesses
Learn how to define the opponent board.
We'll cover the following...
The opponent’s board
With the coordinates represented, let’s move on to the less complex of the two boards—the opponent’s board.
The opponent’s board is nothing but a group of guessed coordinates separated into those that hit an island and those that missed. There will be a large number of unguessed coordinates as well. However, if we identify all the guesses, we can assume the rest are plain “ocean” coordinates.
This sounds like two lists—one for hits and the other for misses. We could wrap these lists in a struct with :hits
and :misses
keys, ...