Exemplo n.º 1
0
def randomTurn():
	global speed
	global backup
	global validator
	randTurn = randrange(0, 2)
	backup = True
	iterations = 0
	while backup:
		randDuration = randrange(2, 7) * 2
		# print 'Turning ' + str(randDuration) + ' steps'
		iterations += randDuration
		backup = False
		validator = 0
		for x in range(0, randDuration):
			if randTurn > 0:
				rightTurn = True
				# print 'Turning right'
				movements.turnRight(speed)
			else:
				rightTurn = False
				# print 'Turning left'
				movements.turnLeft(speed)
		if iterations > 12:
			for y in range(0, 2):
				movements.pinch()
			movements.tailStrike()
			# print 'Intimidate'
			print 'Hissss, get out the way!'
			break
Exemplo n.º 2
0
def wander():
	global speed
	global backup
	global validator
	randDuration = randrange(2, 17) * 4
	# print 'Walking a max of ' + str(randDuration) + ' steps'
	randTurn = True
	for x in range(0, randDuration):
		if backup:
			if x < 8:
				randTurn = False
				break
			else:
				movements.pinch()
				movements.tailStrike()
				# print 'Intimidate'
				for y in range (0, 4):
					movements.walkBackwards(speed)
					# print 'Walking backwards'
			backup = False
			validator = 0
			break
		else:
			if not running:
				break
			movements.walkForwards(speed)
			# print 'Walking forwards'
	if randTurn:
		randomTurn()
	else:
		intuitiveTurn()