def go(): miniSim.resetRobot(robot) rotation = 0 randomNumber = 0 import maze maze.drawMaze(miniSim, robot) while True: while robot.readCenterColorSensor() == (0, 0, 0): robot.move(1) robot.move(-(1)) rotation = 90 randomNumber = robot.random() print randomNumber if (randomNumber < 50): rotation = -(rotation) robot.rotate(rotation)
def go(): miniSim.resetRobot(robot) rotation = 0 randomNumber = 0 import maze maze.drawMaze(miniSim, robot) while True: while robot.readCenterColorSensor() == (0,0,0): robot.move(1) robot.move(-(1)) rotation = 90 randomNumber = robot.random() print randomNumber if (randomNumber<50): rotation = -(rotation) robot.rotate(rotation)
def go(): miniSim.resetRobot(robot) import maze #while True: #robot.rotate(90) maze.drawMaze(robot)
if __name__ == "__main__": maze = Maze(25, random=True) blackPen = Pen() greenPen = Pen() redPen = Pen() blackPen.color("black") greenPen.color("green") redPen.color("red") redPen.ht() wn = turtle.Screen() wn.bgcolor("gray") wn.setup(800, 800) mazeArray = maze.drawMaze() drawMaze(mazeArray, blackPen, greenPen, maze.exit) turtle.ht() # saveScreen("preMaze.png") # distance, dmaze = d.dijkstra(maze,maze.exit[0],maze.exit[1],verbose=True) a.aStar(maze, maze.entrance, maze.exit, verbose=True) # saveScreen("preMaze_d.png") # solveMaze(maze,dmaze,redPen,maze.exit[0],maze.exit[1],distance) # saveScreen("postMaze.png") while True: pass
# This imports the turtle! from turtle import* # This imports the maze import maze # Then the maze is drawn maze.drawMaze() # Put your code below here: # But above here # This tells the program to exit exitonclick()
# This imports the turtle! from turtle import * # This imports the maze import maze # Then the maze is drawn maze.drawMaze() # Put your code below here: # But above here # This tells the program to exit exitonclick()