def locateBall(picture):
	tot_x = 0
	count = 0

	for pixel in getPixels(p):
		r, g, b = getRGB(pixel)
		if r > 200 and g < 100:
			tot_x = tot_x + getX(pixel)
			count = count + 1
	return tot_x/count

main():
	T = 10
	cruiseSpeed = 1
	while timeRemaining(T):
		#take picture and locate the ball
		pic = takePicture()
		ballLocation = locateBall(pic)

		if ballLocation <= 85:
			turnLeft(cruiseSpeed)
		elif ballLocation <=170:
			forward(cruiseSpeed)
		else:
			turnRight(cruiseSpeed)