Example #1
0
    def test_righttest(self):
        robot = Robot()

        robot.place(0, 3, "EAST")

        # turn around full circle
        robot.right()
        self.assertEqual(robot.report(), "(0, 3, SOUTH)")

        robot.right()
        self.assertEqual(robot.report(), "(0, 3, WEST)")

        robot.right()
        self.assertEqual(robot.report(), "(0, 3, NORTH)")

        robot.right()
        self.assertEqual(robot.report(), "(0, 3, EAST)")
Example #2
0
                yCoordinate = int(words[2])
                direction = words[3]

                robot.place(xCoordinate, yCoordinate, direction)
            except ValueError:
                print(
                    "Error: Invalid command parameters, please enter valid command parameters"
                )
        else:
            print("Error: Invalid syntax, please enter valid syntax")
    elif words[0] == "MOVE":
        robot.move()
    elif words[0] == "LEFT":
        robot.left()
    elif words[0] == "RIGHT":
        robot.right()
    elif words[0] == "REPORT":
        robot.report()
    elif words[0] == "AVOID":
        if len(words) == 3:
            try:
                xCoordinate = int(words[1])
                yCoordinate = int(words[2])
                robot.avoid(xCoordinate, yCoordinate)
            except ValueError:
                print(
                    "Error: Invalid command parameters, please enter valid command parameters"
                )
        else:
            print("Error: Invalid syntax, please enter valid syntax")
    elif words[0] == "QUIT":