def brute_force(max_steps): best_action_num = 0 clean = 0 actions = [1, 4, 4, 1, 2, 2, 2, 2] agent = FakeNoMemory(actions) n = 4 m = 4 p = 1.0 state = Global(n, m, p) limit = max_steps test = True current = 0 clean = [0] * max_steps while (test and current < limit): print "Action " + str(current) state.printCurrentWorld() percept = state.getPercept() action = agent.takeStep(percept) test = state.updateWorld(action) clean[current] = state.getNumCleanCells() current += 1 print str(current) + ", " + str(clean) return clean
def _Global_fired(self): global_app = glo.Global( parameters=[glo.Params(name=i) for i in Data.tracefitmodel.params]) global_app.edit_traits(kind='livemodal') global_app = glo.Global(parameters=[])
elif model == 3: vacuum_cleaning_agent = MemoryModel() else: print('Model values should be 1,2 or 3 ') sys.exit(1) m = 10 n = 10 mode = int(input('Map 1 or 2?')) if (mode != 1 and mode != 2): print("default value of 1 taken as given value is not 1 or 2") mode = 1 if (mode == 1): state = Global(n, m) test = True clean = [] current = 0 limit = 2000 while (test and current < limit): state.printCurrentWorld() percept = state.getPercept() action = vacuum_cleaning_agent.Move(percept) print("---Action %d---" % action) test = state.updateWorld(action) current += 1 clean.append(state.getNumCleanCells()) print("* " + str(current) + ", " + str(clean[current - 1]))
line_count=0 with open(str(readPath) + ".csv", encoding='utf-8') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') for column in csv_reader: if line_count <= 3: if line_count==3: name=column[0] print(f'Column names are {", ".join(column)}') line_count += 1 #READING ANSWER KEYS AND ASSIGN IT TO answerkeyPolls answerkeyPolls = inputAnswer.read_and_assign_answerkey(answerkeyPolls,name,QuestionTypes,AllAnswerTextIncludes,AllPollTextIncludes,AnswerKeyCont) inputPoll =Poll.Poll("", "", "","") inputPoll2=Global.Global("", "") line_count = 0 attendancedate="" with open(str(readPath) + ".csv", encoding='utf-8') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') for column in csv_reader: if line_count <= 5: print(f'Column names are {", ".join(column)}') line_count += 1 else: pollFullname = column[1] pollEmail = column[2]