def get_robots_output(self): """ Given a set of commands and plateau dimensions parses this values run robot commands, and yield the current coordinates and orientations. """ while self.commands: coordinates_and_orientation = self.commands.pop(0) coordinates = list( map(int, coordinates_and_orientation.split(' ')[:2])) orientation = coordinates_and_orientation.split(' ')[-1] robot_commands = self.commands.pop(0) robot = Robot(coordinates, orientation, self.plateau_dimensions) [robot.run(command) for command in robot_commands] yield robot.get_coordinate_and_orientation_text()
def test__get_orientation_and_orientation_text__should_return_correct_text( self): target = Robot([1, 2], 'N', [5, 5]) assert target.get_coordinate_and_orientation_text() == '1 2 N'