Example #1
0
 def find_path(self):
     lab_grid = grid()
     bot = robot()
     bot.set_origin(0, 0)
     bot.set_goal(lab_grid, 0, 9)
     y_direction = bot.fy - bot.y
     x_direction = bot.fx - bot.x
     if x_direction > y_direction:
         move_x()
Example #2
0
	def find_path(self):
		lab_grid = grid()
		bot = robot()
		bot.set_origin(0, 0)
		bot.set_goal(lab_grid,0,9)
		y_direction = bot.fy - bot.y
		x_direction = bot.fx - bot.x
		if x_direction > y_direction:
			move_x()
Example #3
0
	def scan_x(self):
		bot = robot()
		grid = grid()
		grid.robolab()

		bot.set_goal(grid, 0, 9)

		rows = len(grid.grid)
		columns = len(grid.grid[0])

		for i in range(0, rows):
			counter = 0
			for j in range(bot.y, bot.fy):
				if grid.grid[i][j] == 1:
					break
				elif grid.grid[i][j] == 0:
					counter += 1
			dmap = [[]]
Example #4
0
                    if check_ahead(bot, grid) == 'end':
                        print 'reached the goal'
                    elif check_ahead(bot, grid):
                        grid.grid[bot.x_temp + 1][bot.y_temp] = 3
                        move.move()
                        y_direction = bot.fy - bot.y_temp
                        x_direction = bot.fx - bot.x_temp
                elif y_direction < 0:
                    move.turn_right()
                    if check_ahead(bot, grid) == 'end':
                        print 'reached the goal'
                    elif check_ahead(bot, grid):
                        grid.grid[bot.x_temp - 1][bot.y_temp] = 3
                        move.move()
                        y_direction = bot.fy - bot.y_temp
                        x_direction = bot.fx - bot.x_temp


grid = grid()
grid.robolab()

bot = robot()

bot.set_origin(0, 0)
bot.set_goal(grid, 0, 9)

move_x(bot, grid)

grid.print_grid()

print bot.x_temp, bot.y_temp
Example #5
0
                        print "reached the goal"
                    elif check_ahead(bot, grid):
                        grid.grid[bot.x_temp + 1][bot.y_temp] = 3
                        move.move()
                        y_direction = bot.fy - bot.y_temp
                        x_direction = bot.fx - bot.x_temp
                elif y_direction < 0:
                    move.turn_right()
                    if check_ahead(bot, grid) == "end":
                        print "reached the goal"
                    elif check_ahead(bot, grid):
                        grid.grid[bot.x_temp - 1][bot.y_temp] = 3
                        move.move()
                        y_direction = bot.fy - bot.y_temp
                        x_direction = bot.fx - bot.x_temp


grid = grid()
grid.robolab()

bot = robot()

bot.set_origin(0, 0)
bot.set_goal(grid, 0, 9)

move_x(bot, grid)

grid.print_grid()

print bot.x_temp, bot.y_temp