The lines are given ID's and there is a predefined list of squares, as lines are selected they are popped from the sublists of valid squares. When a user picks a line that is the last in a sublist it ...