## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### Calculating Line of Sight

The next problem was figuring the line of sight through a hexgrid. Imagine the situation: Tank #1 is at coordinates C4 and Tank #2 is at F9. Can Tank #1 see Tank #2? To put it in more computationally rigorous terms, can Tank #1 trace an unblocked line of sight to Tank #2? See Figure 13.2.

##### Figure 13.2. Determining line of sight (LOS).

The solution to this problem turns out to be rather complicated and mathematical, so I will not delve into its gory details. The problem was exacerbated by the requirement to operate in an 8-bit CPU with no hardware multiplication or division; everything had to be done with logical operations ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required