Beispiel #1
0
    def test_move_off_screen_test_2(self):
        robot = GripperRobot(10, Heading.EAST, (1, 0))
        game = TilingPatternGame((1, 1), 2, RandomRobotReset(GripperRobot, 0),
                                 RandomWorldReset())
        robot.step([True, 0, False, False], game)

        self.assertEqual((1, 0), robot.location)
Beispiel #2
0
    def test_pickup_none_action(self):
        robot = GripperRobot(10, Heading.WEST, (1, 1))
        game = self.default_game()
        game.grid[1][1] = False
        robot.step([False, 0, True, False], game)

        self.assertFalse(robot.hold_object)
        self.assertFalse(game.grid[1][1])
Beispiel #3
0
    def test_drop_occupied_action(self):
        robot = GripperRobot(10, Heading.WEST)
        robot.hold_object = True
        game = self.default_game()
        game.grid[0][0] = True
        robot.step([False, 0, False, True], game)

        self.assertTrue(robot.hold_object)
        self.assertTrue(game.grid[0][0])
Beispiel #4
0
    def test_drop_action(self):
        robot = GripperRobot(10, Heading.WEST, (1, 1))
        robot.hold_object = True
        game = self.default_game()
        game.grid[1][1] = False
        robot.step([False, 0, False, True], game)

        self.assertFalse(robot.hold_object)
        self.assertTrue(game.grid[1][1])
Beispiel #5
0
    def test_pickup_action(self):
        robot = GripperRobot(10, Heading.WEST)
        game = TilingPatternGame((1, 1), 1, RandomRobotReset(GripperRobot, 0),
                                 RandomWorldReset())
        game.reset()
        self.assertTrue(game.grid[0][0])
        robot.step([False, 0, True, False], game)

        self.assertTrue(robot.hold_object)
        self.assertFalse(game.grid[0][0])
Beispiel #6
0
 def test_rotate_robot_8_action(self):
     robot = GripperRobot(10, Heading.WEST)
     game = self.default_game()
     robot.step([False, -1, False, False], game)
     self.assertEqual(Heading.SOUTH, robot.heading)
Beispiel #7
0
 def test_rotate_robot_2_action(self):
     robot = GripperRobot(10, Heading.NORTH)
     game = self.default_game()
     robot.step([False, 0, False, False], game)
     self.assertEqual(Heading.NORTH, robot.heading)
Beispiel #8
0
    def test_move_off_screen_test_3(self):
        robot = GripperRobot(10, Heading.SOUTH, (1, 1))
        game = self.default_game()
        robot.step([True, 0, False, False], game)

        self.assertEqual((1, 1), robot.location)
Beispiel #9
0
    def test_move_forward_test_3(self):
        robot = GripperRobot(10, Heading.NORTH, (0, 1))
        game = self.default_game()
        robot.step([True, 0, False, False], game)

        self.assertEqual((0, 0), robot.location)