Esempio n. 1
0
def whichBall(color):
	minIndex = None
	minSoFar = maxint
	for i in range(10):
		diff = col_diff(color, BALLS_COLOR[i])
		if diff < minSoFar:
			minSoFar = diff
			minIndex = i
	if minSoFar > 30:
		pass
		#print "Warning: > 30, might not be right!", minSoFar
	return minIndex
Esempio n. 2
0
def is_cue_color(color, tolerance = 100):
    """ Return whether this color is cue's color. """
    return col_diff(color, CUE_COLOR) <= tolerance
Esempio n. 3
0
def same(color1, color2, tolerance=50):
	"""Are the two near the same?"""
	return col_diff(color1, color2) < tolerance