def run_game(): #initialize game and create a dispaly object pygame.init() setting = Setting() globalvar.init(setting) pygame.display.set_caption("BB king") globalvar.set_player(character.start_game(1, globalvar.screen)) # game loop while True: # supervise keyboard and mouse item # change stat of objects check_event() update_screen(setting)
#httpd.shutdown() def SvcStop(self): global httpd self.logger.info("service is stop....") self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) self.run = False WebAPI.recordLog("Service stop ...") #停止http服务 httpd.shutdown() if __name__=='__main__': gl.init() gl.setvalue('version', 'v0.17') ## port = 9999 ## httpd = make_server("0.0.0.0",port,WebAPI.application) ## print ("Health serving http on port {0}...".format(str(port))) ## httpd.serve_forever() port = 9999 httpd = make_server("0.0.0.0",port,WebAPI.application) if len(sys.argv) == 1: try: evtsrc_dll = os.path.abspath(servicemanager.__file__) servicemanager.PrepareToHostSingle(PythonService) servicemanager.Initialize('PythonService', evtsrc_dll) servicemanager.StartServiceCtrlDispatcher()
import character import globalvar import Setting setting = Setting.Setting() globalvar.init(setting) character.start_game(1, globalvar.screen) player = globalvar.player() print(len(player)) character.add_character() player = globalvar.player() print(len(player))
def __init__(self, flow_size_list, MAX_EPISODES): super().__init__() gl.init() self.flow_size_list = flow_size_list self.MAX_EPISODES = MAX_EPISODES
# if the model is 'GCN' or 'GAT', undo this comment # output = model(features, adj) loss_test = F.nll_loss(output[idx_test], labels[idx_test]) acc_test = accuracy(output[idx_test], labels[idx_test]) # save GNN model if train_flag: torch.save(model, "./loads/GNN_model") print("Test set results:", "loss= {:.4f}".format(loss_test.item()), "accuracy= {:.4f}".format(acc_test.item())) if __name__ == "__main__": gol.init() gol.set_value('aggr_units_num', 4) # Training settings parser = argparse.ArgumentParser() parser.add_argument('--no-cuda', action='store_true', default=False, help='Disables CUDA training.') parser.add_argument('--trainmode', action='store_true', default=False, help='Enable training.') parser.add_argument('--seqgenflag', action='store_true', default=False, help='Enable generating compute sequence.') parser.add_argument('--fastmode', action='store_true', default=False, help='Validate during training pass.') parser.add_argument('--dataset', type=str, default='citeseer', help='Select a dataset.') parser.add_argument('--model', type=str, default='GCN', help='Select GNN model.') # general paras parser.add_argument('--seed', type=int, default=42, help='Random seed.') parser.add_argument('--epochs', type=int, default=5, help='Number of epochs to train.') parser.add_argument('--lr', type=float, default=0.1, help='Initial learning rate.') parser.add_argument('--weight_decay', type=float, default=5e-4, help='Weight decay (L2 loss on parameters).') parser.add_argument('--hidden', type=int, default=16, help='Number of hidden units.')
datas = msg.replace('$', '').replace('#', '').split(';') if len(datas) >= 10: yaw = float(datas[3]) speed = float(datas[7]) elif msg.startswith('&') and msg.endswith('#'): datas = msg.replace('&', '').replace('#', '').split(';') gz = float(datas[0]) except KeyboardInterrupt: break except Exception: continue ser.close() if __name__ == '__main__': g.init() # 开启串口接收线程 thread.start_new_thread(serial_recv_thread, ()) # 开启RTK线程 thread.start_new_thread(ntrip.fun, ()) # 等待定位成功 while g.getValue('lat') == None or g.getValue('lat') == 0: time.sleep(1) pass logging.info('已定位') # 获取导航点 getPoints('gps.csv') if len(sidePoints) > 1: logging.info('已加载导航点,共有%d个点' % len(sidePoints)) index = 0 pos = Point(g.getValue('lat'), g.getValue('lng'))