def step(direction, key_pressed, direction_string): while not (time.mri_increment() and time.num_chars >= TIME_DECIDE/MRI_TIME): PyGameFuncs.event_loop() refresh_focus() time.reset() #Start from 0 writefile.add_output_buffer_prelim() #Write to file with preliminary info. current_inventory = inventory.inventory maze.step(direction) #Move maze.increment_step_count() decrement_amounts = inventory.decrement() output2d.draw_selected() time.mri_delay(CHOICE_DELAY) time.reset() PyGameFuncs.wait_key_up(key_pressed) #Present message about prize, wait for key release writefile.add_output_buffer_postlim(direction_string, current_inventory, decrement_amounts) #Add more to output writefile.flush_output() #Output to file #Display #pygame.display.flip() three_hallways_step() print 'depth ' + str(maze.position.depth) display()
def step(direction, key_pressed, direction_string): if MRI_ON: while not (time.mri_increment() and time.num_chars >= TIME_DECIDE/MRI_TIME): PyGameFuncs.event_loop() refresh_focus() #so this displays screen for MIN of time decide, and then moves on at hte next 5 keypress?? else: time.mri_delay(TIME_DECIDE) #############Displays for n secs after decision??? time.reset() #Start from 0 display_selected(direction_string)##maybe move this??? time.mri_delay(CHOICE_DELAY)#? #time.reset()#? writefile.add_output_buffer_prelim(subject_num) #Write to file with preliminary info. current_inventory = inventory.inventory maze.step(direction) #Move maze.increment_step_count() #display() #Just in case, refresh decrement_amounts = inventory.decrement() PyGameFuncs.wait_key_up(key_pressed) #Present message about prize, wait for key release #########not sure why this is here. ie about timing and stuff (go test if it works ok later) writefile.add_output_buffer_postlim(direction_string, current_inventory, decrement_amounts) #Add more to output writefile.flush_output(subject_num) #Output to file #Display #pygame.display.flip() three_hallways_step() #print 'depth ' + str(maze.position.depth) display()
def mri_increment(self): if pygame.key.get_pressed()[MRI_CHAR]: self.num_chars += 1 PyGameFuncs.wait_key_up(MRI_CHAR) return True return False