Apr-15-2022, 03:09 PM
(This post was last modified: Apr-15-2022, 03:09 PM by deanhystad.)
The program takes input as command line arguments.
If you want to modify the program so it takes user input instead of using command line arguments you need to replace these lines:
Output:python program.py 14 12 7 6 p
Replace "program" with the name of your program.If you want to modify the program so it takes user input instead of using command line arguments you need to replace these lines:
# change these to get user input instead of using command line args in input_list self.goal_labels = [int(input_list[0]), int(input_list[1])] self.forbidden_label = int(input_list[2]) self.wall_label = int(input_list[3]) input_list = sys.argv # Remove input_list.pop(0) # Remove board = Board(input_list) # Remove input_list # Get this as user input instead of command line args if (len(input_list) == 5) and (input_list[4] == 'p'): q_learn(board, True, 0) elif (len(input_list) == 6) and (input_list[4] == 'q'): q_learn(board, False, int(input_list[5])) else: print('Invalid input, please run again.')