def call_command(command_name, command_arg, robot_name): if command_name == 'help': return do_help() elif command_name == 'forward': return world.do_forward(robot_name, int(command_arg)) elif command_name == 'back': return world.do_back(robot_name, int(command_arg)) elif command_name == 'right': return world.do_right_turn(robot_name) elif command_name == 'left': return world.do_left_turn(robot_name) elif command_name == 'sprint': return world.do_sprint(robot_name, int(command_arg)) elif command_name == 'replay': return do_replay(robot_name, command_arg) return False, None
def call_command(command_name, command_arg, robot_name): if command_name == 'help': return do_help() elif command_name == 'forward': if command_arg == '': return True, f"{robot_name}: Sorry, I did not understand '{command_name}''." return world.do_forward(robot_name, int(command_arg)) elif command_name == 'back': if command_arg == '': return True, f"{robot_name}: Sorry, I did not understand '{command_name}''." return world.do_back(robot_name, int(command_arg)) elif command_name == 'right': return world.do_right_turn(robot_name) elif command_name == 'left': return world.do_left_turn(robot_name) elif command_name == 'sprint': return world.do_sprint(robot_name, int(command_arg)) elif command_name == 'replay': return do_replay(robot_name, command_arg) return False, None
def call_command(command_name, command_arg, robot_name): """ This determines what kind of command the user is giving to the robot """ if command_name == 'help': return do_help() elif command_name == 'forward': return text_world.do_forward(robot_name, int(command_arg)) elif command_name == 'back': return text_world.do_back(robot_name, int(command_arg)) elif command_name == 'right': return text_world.do_right_turn(robot_name) elif command_name == 'left': return text_world.do_left_turn(robot_name) elif command_name == 'sprint': return text_world.do_sprint(robot_name, int(command_arg)) elif command_name == 'replay': return do_replay(robot_name, command_arg) elif command_name == 'mazerun': return mazerun.start_mazerun(robot_name, command_arg) return False, None
def call_command(command_name, command_arg, robot_name): ''' Call command handles the robots commands and executes the various functions related with each paticular command. Param: command_name is the first part of the command i.e. forward Param: command_arg is the 2nd part of the command i.e. 5 ''' if command_name == 'help': return do_help() elif command_name == 'forward': return world.do_forward(robot_name, int(command_arg)) elif command_name == 'back': return world.do_back(robot_name, int(command_arg)) elif command_name == 'right': return world.do_right_turn(robot_name) elif command_name == 'left': return world.do_left_turn(robot_name) elif command_name == 'sprint': return do_sprint(robot_name, int(command_arg)) elif command_name == 'replay': return do_replay(robot_name, command_arg) elif command_name == 'mazerun': return do_mazerun(robot_name, command_arg) return False, None