Sorry, max() is a macro. You can include these lines at the top of your code to define them.
The IR seeker sensor has 5 IR sensors in it. It returns a value of zone 1 through 9. The direct zone of the five sensors are the odd zones 1, 3, 5, 7, 9. The even zones are interpolated zones of the adjacent zones. For example, zone 2 is the interpolation of zone 1 and 3. By doing idx = (idx - 1)/2, it is translating it back to sensor 1 to 5 (or index 0 to 4). For example:
Does it make sense?