Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We need a way to know whether a cell has already been hit. Let’s run through some possibilities, but first, we’ll look at what we know so far...
We have a virtual row of 7 cells, and a DotCom will occupy three consecutive cells somewhere in that row. This virtual row shows a DotCom placed at cell locations 4,5 and 6.
The DotCom has an instance variable—an int array—that holds that DotCom object’s cell locations.