Ejemplo n.º 1
0
def main():
    
    load_bot_config() # bot-specific config (e.g. logger)
    
    tid = current_thread().ident
    logger = config_logger(str(tid))
    
    logger.debug('Client started')
    
    evManager = ClientEventManager()

    clock = CClockController(evManager, config_get_fps()) #the main loop is in there
    g = Game(evManager)
    n = NetworkController(evManager, config_get_hostport(), config_get_nick())
    ic = BotInputController(evManager, g) # simulate inputs    
    
    clock.start()
    
    logger.debug('Client stopped')
Ejemplo n.º 2
0
                        break;
                self.mvtimer = self.mvdelay
                ev = InputMoveRequest(direction, rotating=True)
                self._em.post(ev)


            
#####################################################################            


if __name__ == "__main__":
    import unittest
    from bot.config import load_bot_config
    
    # load config only once (not for each test)
    load_bot_config()
    
    class MockEvMgr():
        callbacks = {} # map events to callbacks
        posted = [] # tracks posted events
        def post(self, ev):
            self.posted.append(ev)
        def reg_cb(self, evt, cb):
            self.callbacks[evt] = cb
        
    class TestBotConfig(unittest.TestCase):
        
        def setUp(self):
            self.em = MockEvMgr()
        
        def test_all(self):
Ejemplo n.º 3
0
 def setUp(self):
     load_bot_config()