def __init__(self, actr=False):
            self.actr = actr
            if ACTR6 and self.actr:
                self.state = self.STATE_WAIT_CONNECT
                self.actr = JNI_Server(self, clock=Twisted_MPClock())
                self.actr.addDispatcher(self.d)
                print "Waiting for connection fron JNI module"
                reactor.listenTCP(5555, self.actr)

            self.lc1 = LoopingCall(self.update_env)
            self.lc1.start(1.0 / 30)
    def __init__(self, actr=False):

        self.screen_rect = pygame.Rect(0, 0, 350, 350)
        self.screen = pygame.display.set_mode(
            (self.screen_rect.width, self.screen_rect.height), 0)

        self.grid_color = (128, 128, 128)
        self.max_font_size = int(
            min([self.screen_rect.width, self.screen_rect.height]) / 4)

        self.font = pygame.font.Font(pygame.font.match_font("Monospace", True),
                                     self.max_font_size / 5)
        self.spinner = ['|', '|', '/', '/', '-', '-', '\\', '\\']
        self.spinner_index = 0

        self.intro_t = self.font.render("Click the red 'X' to start!", True,
                                        (0, 0, 0))
        self.intro_ts = self.intro_t.get_rect()
        self.intro_ts.center = self.screen_rect.center
        self.intro_x = self.font.render("X", True, (255, 0, 0))
        self.intro_xs = self.intro_x.get_rect()
        self.intro_xs.center = (randint(0, self.screen_rect.width),
                                randint(0, self.screen_rect.height))
        while not self.screen_rect.contains(
                self.intro_xs) or self.intro_ts.colliderect(self.intro_xs):
            self.intro_xs.center = (randint(0, self.screen_rect.width),
                                    randint(0, self.screen_rect.height))

        self.snd_correct = pygame.mixer.Sound("beep-3.wav")
        self.snd_incorrect = pygame.mixer.Sound("beep-5.wav")

        self.trial = 0
        self.fake_cursor = self.screen_rect.center

        self.state = self.STATE_INTRO
        self.actr = actr
        self.actr_time_lock = False
        if ACTR6 and self.actr:
            self.state = self.STATE_WAIT_CONNECT
            self.actr = JNI_Server(self, clock=Twisted_MPClock())
            self.actr.addDispatcher(self.d)
            reactor.listenTCP(5555, self.actr)

        self.lc1 = LoopingCall(self.update_env)
        self.lc1.start(1.0 / 30)

        self.coop = Cooperator()
        self.coop.coiterate(self.process_event())