Implementing “Lines” Strategies
As I already said in Chapter 2, the lines strategies rely on parallel rows and columns. You can implement all lines strategies with three small functions named lines_2(), lines_3(), and lines_4() (see the respective Listing 9-1, 9-2, and 9-3) that set up the arguments for and then execute a generalized function named lines() (see Listing 9-4).
The idea is to form, one by one, all possible combinations of two line IDs and then pass them to lines() for processing. The number of possible line pairs is (C9,2 means: number of combinations of nine objects taken two at a time).
C9,2 = 9*8 / 2! = 36 ...