How it works...

The algorithm makes use of its private functions in order to adapt itself to the general functions derived from the parent's class, and it relies on simple mathematical functions to convert a two-dimensional vector position to a one-dimensional vector, or vertex index.

The LoadMap function needs to be implemented by you using your own map files, but, in the next section, we'll learn a way of implementing and reading certain kinds of text files containing maps based on grids. This will give you an idea of how to handle your files, and even use the same format for the commodity.