コード例 #1
0
ファイル: main.py プロジェクト: walterm/6.S078-A1
    obstacles = [o]#,o1]

    safe = [robot.loc]

    # while it's not at the goal state
    while goalTest(robot.loc, goal) == False:
        target = robot.plan.pop(0)
        targetx = target[0] * delta_x
        targety = target[1] * delta_y

        # make sure that point itself has space
        obsCheck = map(lambda o: o.containsPoint((targetx, targety)), obstacles)
        if True in obsCheck:
            x, y = safe.pop()
            robot.translate(x, y)
            robot.plan = node.search(robot.loc, goal)
            drawPath(robot.plan, delta_x, delta_y)
            node.BadLocations.addBadLoc(target)
            continue

        # make sure every place along that path is possible

        targetx = target[0] * delta_x
        targety = target[1] * delta_y

        currentx = robot.loc[0] * delta_x
        currenty = robot.loc[1] * delta_y

        # we're headed
        _dir = direction(robot.loc, target)
        dx, dy = _dir
コード例 #2
0
 def search(self, x):
     return node.search(self.root, x)
コード例 #3
0
ファイル: BinaryTree.py プロジェクト: Saito-/ProconCharange
	def search(self, x):
		return node.search(self.root, x)