예제 #1
0
 def match_point():
     i = 0
     while bad(J[i], Type) and i < len(J) - 1:
         i += 1
     if i == len(J) - 1:
         # print "Exhausted the landscape. Could not find a point to match."
         return "Exhausted the landscape. Could not find a point to match."
     else:
         util.sorted_insert(J.pop(i), K)
         return "Success! See if we can match another point."
예제 #2
0
 def bad(index, Type):
     # append newcomer to list; try it on for size
     new = util.sorted_insert(index, K)
     result = test(K[new - 1], K[new], Type) or test(K[new],
                                                     K[new + 1], Type)  # how did we do?
     K.pop(new)  # return list back to normal
     return result