Boards
Let's discuss the rules of the board and introduce data transformation.
We'll cover the following
Let’s move on to the Board
module now.
Rules of the board
The player’s board contains their islands and also brokers messages for the islands. Sometimes it will need to reference individual islands, for example, when checking to see if one is forested. At other times, it will need to enumerate over all the islands—for example, when checking for a win.
This means we can represent the islands with a map, using their names as the keys. We can reference a given island with its key, ensure there are no duplicate island types, and enumerate over all the islands with any enumerable function.
Get hands-on with 1400+ tech skills courses.