In this application, we often use 0 to denote a horizontal slot and 1 to denote a vertical slot. This utility routine inverts the sense of such a value. Assuming the value is either 0 or 1, subtracting the value from 1 will give the opposite value.
# - - - p e r p e n d i c u l a r def perpendicular ( isV ): '''Invert an 'isV' flag. [ if isV is 0 -> return 1 if isV is 1 -> return 0 ] ''' return 1-isV