def main(): file_name = input("Insert the file name (default: rovers.txt)\n") f = open(file_name,'r') lines = f.read().splitlines() bound = lines[0].split() if(len(bound) != 2): print("Bound error. Please, review the bounds in the file\n") return -3 Rover.set_boundaries(int(bound[0]),int(bound[1])) i = 1 while (i < (len(lines) -1)): rv = lines[i].split() if(len(rv)!=3): print("Rover definition error. Please, review the location of the rover %s in the file\n"%(i)) return -4 r = Rover(int(rv[0]), int(rv[1]),rv[2]) r.execute_commands(lines[i+1]) i = i + 2 r.print_rover() f.close()
def test_object(r): r.print_rover() r2 = Rover(3,3,'E') r2.print_rover()