Beruflich Dokumente
Kultur Dokumente
Taking the # off of one of these phrases, lets me run that program. This
is useful because I can run as many puzzles as I want without having to
run their separate code.
#from moveLightWorld import *
#from chasingLightWorld import *
#from obstacleWorld import *
#from wallWorld import *
from mazeWorldDrawn import *
#from mazeWorld import *
#Baseline follow Light behavior
def followLight():
while True:
left,center,right=myGetLight()
myMotors(center,center)
#Infrared Behaviors. Use with wallWorld, obstacleWorld, mazeWorld
def stopAtWall():
while True:
left,right = getIR()
if(left==1 or right==1):
myMotors(1,1)
else:
myMotors(0,0)
break;
#Example of getLine(). Use in mazeWorldDrawn
def stopDrawnWall():
penDown("orange")
while True:
left,right = getLine()
if(left==1 or right==1):
translate(random()) # robot backs up random amout
wait(random()) #see comment above
rotate(random()) #robot robots random amount
wait(random()) #see comment above
else:
myMotors(1,1)