示例#1
0
def reset_for_next_sequence_execution(game, draw_progress_bool=True):
    game.last_trial_recorded_bool = False
    gg.draw_fixation(game, xpos=0.5 * game.SCREEN_WIDTH, color=game.FIXATION_COLOR)
    game.timers["move"].reset()
    game.timers["move_limit"].soft_reset()
    game.current_sequence_complete = False
    game.timers["score"].time_limit_hit = False
    game.sequence_progress[:] = game.SEQUENCE_INCOMPLETE
    game.key_in_sequence = 0
    game.last_key_pressed = -1
    if draw_progress_bool:
        gg.draw_sequence_progress(game)
示例#2
0
def run_sequence_move(game):
    # |*|*|* * *
    #############
    #     *     #
    #############
    if game.current_key != game.last_key_pressed and game.current_key != "none":
        game.last_key_pressed = game.current_key
        if game.current_key == game.current_sequence[game.key_in_sequence]:
            game.sequence_progress[game.key_in_sequence] = "correct"
            game.key_in_sequence += 1
        else:
            game.sequence_progress[game.key_in_sequence] = "wrong"
            game.key_in_sequence += 1
    if game.key_in_sequence > 4:
        game.current_sequence_complete = True
    gg.draw_sequence_progress(game)
示例#3
0
 def run(self):
     while True:
         time_passed = self.clock.tick_busy_loop(self.FRAME_RATE)
         self.check_input()
         self.check_key_status()
         self.draw_background()
         if self.show_keyboard:
             gg.draw_keyboard(self)
         if self.run_trials:
             fu.frame_record(game, game.f_frame, time_passed)
             gg.draw_frame_rectangle(self)
             if not(self.timers['cue'].time_limit_hit):
                 self.timers['cue'].update(time_passed)
                 gr.run_sequence_cue(self)
             elif not(self.current_sequence_complete):
                 self.timers['move'].update(time_passed)
                 if not(self.self_paced_bool):
                     self.timers['move_limit'].update(time_passed)
                     if self.timers['move_limit'].time_limit_hit:
                         self.current_sequence_complete = True
                 gr.run_sequence_move(self)
             elif (not(self.self_paced_bool)
                       and not(self.timers['move_limit'].time_limit_hit)):
                 self.timers['move_limit'].update(time_passed)
                 gg.draw_sequence_progress(self)
             elif not(self.timers['score'].time_limit_hit):
                 self.timers['score'].update(time_passed)
                 if game.current_sequence == game.REST_SEQUENCE:
                     gr.run_sequence_score_rest(self)
                 else:
                     gr.run_sequence_score(self)
             elif not(self.timers['score'].count_limit_hit):
                 gr.reset_for_next_sequence_execution(self)
             elif self.trial_count < self.trials_per_run:
                 gr.reset_for_next_sequence_trial(self)
             else:
                 self.run_trials = False
                 if SENSOR_ACTIVE:
                     self.daq.set_digital_out(0)
         else:
             self.draw_splash()
         if self.debug_bool:
             self.draw_debug(time_passed)
         pygame.display.flip()