def initial(): global f ##文件 global txt global number_of_occurrence reload(sys) sys.setdefaultencoding('utf-8') ctr.init() ctr.set_value('flag', 0) ctr.set_value('reload_check', 0) ctr.set_value('world_boss_check', 0) ctr.set_value('raid_check', 0) #ctr.set_value('raid_check',None) number_of_occurrence = 0 ctr.set_value('max_level_check', None) ctr.set_value('return_check', 0) ticks = time.time() date = time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime(ticks)) + '_日誌' f = open(date + '.txt', 'w', 0) frame = JFrame("Log") txt = JTextArea(19, 55) scrollPane = JScrollPane(txt) ##frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setLocation(2000, 100) frame.setSize(480, 450) frame.setLayout(FlowLayout()) ##label = JLabel('記錄:') scrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) ##frame.add(label) frame.add(scrollPane) frame.setVisible(True)
def initializeHardware(): """Initialize hardware (e.g. sensors) for use. """ # Initialize one-wire temperature sensor temperature.init() # Initialize GPIO pins for controller in controllers: controller_methods.init(controllers[controller])
def robo1(col="green"): try: paths, direcs = controller.init(datas) for i in range(len(paths[0])-1): joinLines(paths[0][i],paths[0][i+1],col, 0) except: pass
def main(): from player_new import Player from board import Board game_board = Board.from_file_name("Arena1.txt") client_player = Player(game_board, "player_1", 0) actions = { "up": { True: UpdateDirection(client_player, 0, True), False: UpdateDirection(client_player, 0, False) }, "left": { True: UpdateDirection(client_player, 2, True), False: UpdateDirection(client_player, 2, False) }, "down": { True: UpdateDirection(client_player, 4, True), False: UpdateDirection(client_player, 4, False) }, "right": { True: UpdateDirection(client_player, 6, True), False: UpdateDirection(client_player, 6, False) }, "place bomb": { True: PlaceBomb(client_player), False: Dummy() }, "punch": { True: Punch(client_player), False: Dummy() }, "detonate": { True: Dummy(), False: Dummy() }, } pygame.init() pygame.display.set_mode((500, 500)) controllers = controller.init() binding = KeyBinds(actions) binding.load_controls("controller_default.json") clock = pygame.time.Clock() print(pygame.key.get_focused()) while True: for cont in controllers: cont.generate_events() cont.post_events() for event in pygame.event.get(): binding.push_event(event) binding.update_keystate() commands = binding.get_commands() if commands: print(commands) #print(binding.keystate) clock.tick(30)
def src_dest(col="red"): global direcs paths, direcs = controller.init(datas) try: for i in range(len(paths[2])-1): joinLines(paths[2][i],paths[2][i+1],col, 10) except: for i in range(len(paths[1])-1): joinLines(paths[1][i],paths[1][i+1],col, 10)
def thread_cycle(): while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: print("Cargando información de los archivos ....") cont = controller.init() elif int(inputs[0]) == 2: optionTwo(cont) elif int(inputs[0]) == 3: optionThree(cont) elif int(inputs[0]) == 4: optionFour(cont) elif int(inputs[0]) == 5: optionFive(cont) elif int(inputs[0]) == 6: optionSix(cont) elif int(inputs[0]) == 7: optionSeven(cont) else: sys.exit(0) sys.exit(0)
def thread_cycle(): while True: printMenu() inputs = input('Seleccione una opción para continuar\n>') if int(inputs[0]) == 1: print("Cargando información de los archivos ....") ana = controller.init() optionOne(ana) elif int(inputs[0]) == 2: optionTwo(ana) elif int(inputs[0]) == 3: optionThree(ana) elif int(inputs[0]) == 4: ini = optionFour(ana) elif int(inputs[0]) == 5: optionFive(ana, ini) elif int(inputs[0]) == 6: optionSix(ana) elif int(inputs[0]) == 7: optionSeven(ana) elif int(inputs[0]) == 8: optionEight(ana) elif int(inputs[0]) == 9: optionNine(ana) else: sys.exit(0) sys.exit(0)
def thread_cycle(): while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: print("Cargando información de los archivos ....") cont = controller.init() elif int(inputs[0]) == 2: print("\nInicializando....") controller.loadServices(cont) rta = controller.sacar_info(cont) print("***************") print (str("-El total de landing points es: " + str(rta[0]))) print (str("-El total de conexiones entre landing points es: " + str(rta[1]))) print (str("-El total de países es:" + str(rta[2]))) print(str("-La información del primer landing point es: ")) print(str(" ") + str(rta[3])) print (str("-La población del último país cargado es: " + str(rta[4]))) print (str("-El número usuarios de Internet del último país cargado es: " + str(rta[5]))) print("***************") elif int(inputs[0]) == 3: #req 1 landing_1= input("Nombre del landing point 1 (Ejem. Redondo Beach- 4992):") landing_2= input("Nombre del landing point 2 (Ejem. Vung Tau-6013):") clusteres = controller.connectedComponents(cont) landing_pints = controller.estan_closter(cont,landing_1,landing_2) print("-------------------------------------------------------") print("") print("Número total de clústeres presentes en la red: " + str(clusteres)) if landing_pints: print("Los dos landing points están en el mismo clúster") else: print(" los dos landing points NO están en el mismo clúster") elif int(inputs[0]) == 4: #req 2 rta=controller.servedRoutes(cont) print("-------------------------------------------------------") print("lista de landing points: ") iterador_1 =it.newIterator(rta[1]) iterador_2 =it.newIterator(rta[2]) while it.hasNext(iterador_1) and it.hasNext(iterador_2): nombre = it.next(iterador_1) id = it.next(iterador_2) print("") print("Nombre y pais del landing point: " + str(nombre)) print("ID del landing point: " + str(id)) print("") print("") print("El total de cables conectados a dichos landiing points son:" + str(rta[0])) elif int(inputs[0]) == 5: #req 3 Pais_1 = " " + input("Primer país (Eje. Colombia) : ") Pais_2 = " " + input("Segundo país (Eje. Indonesia) : ") controller.minimumCostPaths(cont, Pais_1) camino = controller.camino(cont,Pais_2) iterador = it.newIterator(camino) print("-------------------------------------------------------") print("Camino del primer pais al segundo pais:") while it.hasNext(iterador): elemento = it.next(iterador) print(elemento) distancia = controller.distancia_total(cont,Pais_2) print("") print("") print("La distancia total entre los dos landing points es:") print(distancia) elif int(inputs[0]) == 6: #req 4 rta=controller.infraestructura_critica(cont) print("-------------------------------------------------------") print("") print("El número de nodos conectados a la red de expansión mínima es: " + str(rta[0])) print("El costo total (distancia en [km]) de la red de expansión mínima es: " + str(rta[1]) + " Km") print("La rama más larga es " + str(rta[2]) + " con una longitud de " + str(rta[3]) + " km") print("") elif int(inputs[0]) == 7: #req 5 landing = input("Nombre del landing point (Ejem. Fortaleza):") rta=controller.inpacto_landing(cont, landing) print("-------------------------------------------------------") print("") print("EL número de paises es: " + str(rta[0])) print("Los paises son: ") print("") iterador = it.newIterator(rta[1]) while it.hasNext(iterador): Pais = str(it.next(iterador)) print(Pais) print("") elif int(inputs[0]) == 8: #req 6 pais = input("Nombre del país (Ejem. Cuba): ") cable = input("Nombre del cable (Ejem. ALBA-1): ") rta =controller.ancho_de_banda(cont, pais, cable) iterador = it.newIterator(rta[0]) iterador_2 = it.newIterator(rta[1]) print("-------------------------------------------------------") while it.hasNext(iterador) and it.hasNext(iterador_2): nombre = it.next(iterador) ancho_banda = it.next(iterador_2) print("") print("Nombre del Pais Conectado: " + str(nombre)) print("Ancho de banda: " + str(ancho_banda) + " 𝑀𝑏𝑝s") print("") elif int(inputs[0]) == 9: #req 7 ruta_1 = input("Ingrese la Dirección IP1 (Ejem. 165.132.67.89 ): ") ruta_2 = input("Ingrese la Dirección IP2 (Ejem. 8.8.8.8): ") rta =controller.saltos_minimos(cont, ruta_1, ruta_2) print("-------------------------------------------------------") print(rta) else: sys.exit(0) sys.exit(0)
def translate(value, leftMin, leftMax, rightMin, rightMax): # Figure out how 'wide' each range is leftSpan = leftMax - leftMin rightSpan = rightMax - rightMin # Convert the left range into a 0-1 range (float) valueScaled = float(value - leftMin) / float(leftSpan) # Convert the 0-1 range into a value in the right range. return(rightMin + (valueScaled * rightSpan)) if __name__ == '__main__': controller.init() motorSerial = serial.Serial('/dev/ttyUSB0', 9600, timeout=0.1) xbox = controller.getController() while(True): leftSpeed = 0 rightSpeed = 0 buttons = controller.getButtons(xbox) triggers = controller.getTriggers(xbox) leftSpeed += translate(triggers["LT"], -1, 1, 0, 250) rightSpeed += translate(triggers["LT"], -1, 1, 0, 250) leftSpeed -= translate(triggers["RT"], -1, 1, 0, 250) rightSpeed -= translate(triggers["RT"], -1, 1, 0, 250)
def init(): return controller.init()
import controller import comm import time import math def update_servo_pos(conn): state = controller.get_state() new_pos = int((-1 * math.degrees( math.asin( state['trigger'] ) )) + 90) print new_pos comm.send(conn,new_pos) # Main entry if __name__ == "__main__": conn = comm.init(6,115200) controller.init() while True: controller.processEvents() update_servo_pos(conn) conn.close()
def init(): controller.init()
if item != None: print("=>", item) analyzer = None sys.setrecursionlimit(1000 * 1000) """ Menu principal """ while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: # Construcción analyzer print("Cargando información de los archivos ....") analyzer = controller.init() # Carga de Datos resultado = controller.loadLandingPoints(analyzer) loadConnections = controller.loadConnectionsCSV(analyzer) pais = controller.loadCountries(analyzer)['value'] # Prints print( f"\nTotal de landing points: {gr.numVertices(analyzer['landingPoints'])}" ) print( f"\nTotal de conexiones: {gr.numEdges(analyzer['landingPoints'])}") print(f"\nTotal de paises: {mp.size(analyzer['countries'])}") print(
bokehlog = logging.getLogger("songexplorer") bokehlog.setLevel(logging.INFO) #bokehlog.info(...) _, configuration_file = argv import model as M import view as V import controller as C doc = curdoc() M.init(doc, configuration_file) V.init(doc) C.init(doc) cluster_buttons = row(V.which_layer, V.which_species, V.which_word, V.which_nohyphen, V.which_kind, column(V.color_picker, width=75, align='end'), width=M.gui_width_pix - 75) navigate_buttons = row( column(Spacer(height=41, width=40), column(V.panleft, width=50), Spacer(height=41, width=40), column(V.allleft, width=50)), column(V.zoomin, V.reset, V.zoomout, V.allout, width=50), column(Spacer(height=41, width=40), column(V.panright, width=50), Spacer(height=41, width=40), column(V.allright, width=50))) label_widgets = row(column(V.label_count_widgets),
print( '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' ) database = None """ Menu principal """ while True: printMenu() inputs = input('Seleccione una opción para continuar: ') if int(inputs[0]) == 1: print("\nInicializando....") database = controller.init() elif int(inputs[0]) == 2: print("Cargando información de los archivos ....") database = controller.loadevent(database) # Requerimiento 1. elif int(inputs[0]) == 3: print("\n") print('Caracteristicas Disponibles: ') print("\n") print(" --> Instrumentalness") print(" --> Acousticness") print(" --> Liveness") print(" --> Speechiness") print(" --> Energy") print(" --> Danceability")
def robo2(col="blue"): paths, direcs = controller.init(datas) for i in range(len(paths[1])-1): joinLines(paths[1][i],paths[1][i+1],col, -10)
def thread_cycle(): while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: print("\nInicializando....") cont = controller.init() elif int(inputs[0]) == 2: print("Cargando información de los archivos ....") answer = controller.loadConnections(cont, landingPointsFile, connectionsFile, countriesFile) totalEdges = controller.totalConnections(cont) totalVertex = controller.totalStops(cont) totalCountries = controller.totalCountries(cont) print('\n') print('Cantidad total de arcos: ' + str(totalEdges)) print('Cantidad total de vertices: ' + str(totalVertex)) print('Cantidad total de países: ' + str(totalCountries)) print('El límite de recursión actual: ' + str(sys.getrecursionlimit())) firstLandingPoint = answer[1] print('') print('Primer landing point cargado: ') print('Identificador: ' + firstLandingPoint['id']) print('Nombre: ' + firstLandingPoint['name']) print('Latitud: ' + firstLandingPoint['latitude']) print('Longitud: ' + firstLandingPoint['longitude']) lastCountry = answer[2] print('') print('Último país cargado: ') print('Nombre: ' + lastCountry['CountryName']) print('Población: ' + lastCountry['Population']) print('Usuarios de internet: ' + lastCountry['Internet users']) print('') print("Tiempo [ms]: ", f"{answer[3]:.3f}", " || ", "Memoria [kB]: ", f"{answer[4]:.3f}") elif int(inputs[0]) == 3: landingPoint1 = input("Ingrese el nombre del landing point 1: ") landingPoint2 = input("Ingrese el nombre del landing point 2: ") answer = controller.findClusters(cont, landingPoint1, landingPoint2) clusters = answer[1] sameCluster = answer[2] print('') print("Número total de clústeres: " + str(answer[1])) if sameCluster: print("¿Están en el mismo cluster?: Si") else: print("¿Están en el mismo cluster?: No") print('') print("Tiempo [ms]: ", f"{answer[3]:.3f}", " || ", "Memoria [kB]: ", f"{answer[4]:.3f}") elif int(inputs[0]) == 4: answer = controller.findInterLandingPoints(cont) totalCables = answer[0] landingPoints = answer[1] print('') print("Lista de landing points: ") print(landingPoints) print('') print('Total de cables conectados: ' + str(totalCables)) print('') print("Tiempo [ms]: ", f"{answer[2]:.3f}", " || ", "Memoria [kB]: ", f"{answer[3]:.3f}") elif int(inputs[0]) == 5: pais1 = input("Ingrese el nombre del país 1: ") pais2 = input("Ingrese el nombre del país 2: ") answer = controller.findShortestPath(cont, pais1, pais2) connections = answer[1] distance = answer[2] print('') print("Ruta: ") for conn in connections: print('Origen: ' + conn['origin'] + ', Destino: ' + conn['destination'] + ', distancia: ' + str(conn['distance'])) print('') print('Distancia total de la ruta: ' + str(distance)) print('') print("Tiempo [ms]: ", f"{answer[3]:.3f}", " || ", "Memoria [kB]: ", f"{answer[4]:.3f}") elif int(inputs[0]) == 6: answer = controller.criticalInfrastructure(cont) numNodes = answer[1] totalCost = answer[2] longestBranch = answer[3] print('') print("Número de nodos conectados a la red de expansión mínima: " + str(numNodes)) print('') print('Costo total: ' + str(totalCost)) print('') print('Rama más larga: ' + str(longestBranch)) print('') print("Tiempo [ms]: ", f"{answer[4]:.3f}", " || ", "Memoria [kB]: ", f"{answer[5]:.3f}") elif int(inputs[0]) == 7: landingPoint = input("Ingrese el nombre del landing point: ") answer = controller.failImpact(cont, landingPoint) totalCountries = answer[1] countries = answer[2] print('') print('Número de países afectados: ' + str(totalCountries)) print('') print("Lista de países afectados: ") for country in countries: print(country['country'] + ' - ' + str(country['distance']) + ' km') print('') print("Tiempo [ms]: ", f"{answer[3]:.3f}", " || ", "Memoria [kB]: ", f"{answer[4]:.3f}") else: sys.exit(0) sys.exit(0)
import drivers.ili9486py as disp import drivers.encoder as enc import network import ubinascii import password import utime import time import urequests as requests import ujson import machine from machine import Pin from machine import Timer import controller as con #flashing micropython: # esptool.py --chip esp32 --port COM4 erase_flash # esptool.py --chip esp32 --port COM4 write_flash -z 0x1000 esp32-idf3-20200902-v1.13.bin #copying files via ampy: # ampy --port COM4 put boot.py # ampy --port COM4 put controller.py # ampy --port COM4 put view.py # ampy --port COM4 put logic.py # ampy --port COM4 put drivers disp.init() con.init() enc.init(con.onClick, con.onLeft, con.onRight) while True: con.update() utime.sleep_ms(10)
def initController(self): if self.app and domaindata.initialized() and self.mainFrame: controller.init(self)
""" while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: tipo = int( input( "Ingrese 1 si desea manejar las colisiones con el método chaining o 2 para linear probing: " )) #tipo = 2 load_factor = float( input("Ingrese el factor de carga con el que desea trabajar: ")) #load_factor = 0.5 print("Cargando información de los archivos...") #cambio medida tiempo y memoria catalog = controller.init(tipo, load_factor) answer = controller.loadData(catalog, tipo) print('El total de registros de eventos de escucha cargados es de: ' + str(lt.size(catalog['Eventos']))) print('El total de artistas únicos cargados es de: ' + str(lt.size(catalog['Artistas']))) print('El total de pistas de audio únicas cargadas es de: ' + str(mp.size(catalog['Pistas']))) print_events(catalog) print("Cargado correctamente") print("Tiempo [ms]: ", f"{answer[0]:.3f}", " || ", "Memoria [kB]: ", f"{answer[1]:.3f}") elif int(inputs[0]) == 2: #content = 'instrumentalness' content = input( 'Ingrese la característica sobre la que desea hacer la consulta: '
import libs import sys import controller as hue from multithread import Intervention from pygame import time as pgtime # hue.init(bridge_ip = "128.12.141.85") hue.init() hue.group.on = True hue_delay = 0 cmd1 = hue.make_command([255, 200, 80], 255, hue_delay) cmd2 = hue.make_command([255, 210, 100], 255, hue_delay) cmd3 = hue.make_command([255, 230, 120], 255, hue_delay) cmds = [cmd1, cmd2, cmd3] # test1_int = Intervention('TEST', 1, [print, pgtime.delay, print, pgtime.delay], [['C'], [3000], ['D'], [3000]]) hue.set_group(cmd1) clock = pgtime.Clock() experiments = 15 delay = 0 total_delay = 0 count = 10 interval = 500 experiment_delay = 3000 minimum = 1000000 maximum = -1 for j in range(experiments): for i in range(count): sys.stdout.write('*') sys.stdout.flush() clock.tick() hue.set_group(cmds[i%3], hue.group)
print("8- La mejor ruta para comunicarme") print("9- Graficando los Grafos") print("0- Salir") print("*******************************************") catalog = None """ Menu principal """ while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: print("Cargando información de los archivos ....") cont = controller.init() controller.loadServices(cont, 'landing_points.csv', "connections.csv") controller.printpaises(cont) print("numero vertices: " + str(controller.totalVert(cont))) print("el numero de arcos es: " + str(controller.totalConnections(cont))) elif int(inputs[0]) == 2: verta = input("ingrese el primer vertice: ") vertb = input("ingrese el segundo vertice: ") connect = controller.vertexComponents(cont, verta, vertb) print("los vertices " + connect) elif int(inputs[0]) == 3: maxvert, maxdeg = controller.servedRoutes(cont) print('Vertice: ' + maxvert + ' Total de conecciones: ' + str(maxdeg)) elif int(inputs[0]) == 4:
curr_distance = CTRL.front_distance() print(curr_distance,"cm") if curr_distance < 8: return elif curr_distance > 8 and curr_distance < 20: CTRL.LED_all_on() """ CTRL.motor_stop() time.sleep(0.2) CTRL.motor_reverse() time.sleep(2) CTRL.motor_stop() time.sleep(0.2) CTRL.motor_right() time.sleep(2.0) CTRL.motor_stop() time.sleep(0.2) """ else: CTRL.motor_forward() CTRL.LED_all_off() CTRL.init() start() CTRL.LED_all_off() CTRL.motor_stop()
from lib import wait_for_job, check_file_exists repo_path = os.path.dirname(sys.path[0]) sys.path.append(os.path.join(repo_path, "src/gui")) import model as M import view as V import controller as C os.makedirs(os.path.join(repo_path, "test/scratch/seeds")) shutil.copy(os.path.join(repo_path, "configuration.pysh"), os.path.join(repo_path, "test/scratch/seeds")) M.init(None, os.path.join(repo_path, "test/scratch/seeds/configuration.pysh")) V.init(None) C.init(None) os.makedirs(os.path.join(repo_path, "test/scratch/seeds/groundtruth-data/round1")) shutil.copy(os.path.join(repo_path, "data/PS_20130625111709_ch3.wav"), os.path.join(repo_path, "test/scratch/seeds/groundtruth-data/round1")) run(["hetero", "start", "1", "1", "1"]) shutil.copy(os.path.join(repo_path, "data/PS_20130625111709_ch3-annotated-person1.csv"), os.path.join(repo_path, "test/scratch/seeds/groundtruth-data/round1")) V.context_ms_string.value = "204.8" V.shiftby_ms_string.value = "0.0" V.optimizer.value = "adam" V.learning_rate_string.value = "0.0002" V.representation.value = "mel-cepstrum"
def main(): pygame.init() host = input("Enter host IP (leave blank for localhost): ") if host == "": host = None #host = "3.17.188.254" client, username, game_board, players = connect(host=host, port=4832) client_player = players[username] WIDTH, HEIGHT = game_board.get_dimensions() print(WIDTH, HEIGHT) screen = pygame.display.set_mode((WIDTH, HEIGHT)) clock = pygame.time.Clock() font = pygame.font.SysFont("Arial", 50) def update_fps(): fps = str(int(clock.get_fps())) fps_text = font.render(fps, 1, pygame.Color("green")) return fps_text menu = Menu(screen) controllers = controller.init() # controls = Menu(screen, "Controls") controls = ControlsMenu(screen, ["Player1", "Player2", "Player3"], ControlsMenu.CONTROLS) menu.add_menu(controls) menu.add_button("Exit Game", lambda: pygame.event.post(pygame.event.Event(pygame.QUIT, dict()))) menus = [menu, controls] actions = { "up": { True: UpdateDirection(client_player, 0, True), False: UpdateDirection(client_player, 0, False) }, "left": { True: UpdateDirection(client_player, 2, True), False: UpdateDirection(client_player, 2, False) }, "down": { True: UpdateDirection(client_player, 4, True), False: UpdateDirection(client_player, 4, False) }, "right": { True: UpdateDirection(client_player, 6, True), False: UpdateDirection(client_player, 6, False) }, "place bomb": { True: PlaceBomb(client_player), False: None }, "punch": { True: Punch(client_player), False: None }, "detonate": { True: None, False: None }, } binding = KeyBinds(actions) binding.load_controls("controller_default.json") game_queue = Queue() KEYS = [pygame.K_w, pygame.K_a, pygame.K_s, pygame.K_d] t = threading.Thread(target=input_thread, args=(client, input_callback, username), name="client chat input") t.setDaemon(True) t.start() convert_sheets() times_test = [] warmup = True running = True while running: for message in client.collect_messages(): if message[0] == 0: # reset player list names = message[1].split(",") game_board.clear_players() players = load_players(names, game_board) client_player = players[username] elif message[0] == 1: # game command objects = players.copy() objects[game_board.get_id()] = game_board c = deserialize(message[1], objects) print(message[1]) game_queue.put(c) elif message[0] == 2: # chat message print(message[1]) elif message[0] == 3: # board update print("loaded board") game_board = Board.from_string(message[1]) elif message[0] == 4: # remove player del players[message[1]] elif message[0] == 5: # add player name, id = message[1].split(",") for cont in controllers: cont.generate_events() cont.post_events() for event in pygame.event.get(): [menu.update(event) for menu in menus] binding.push_event(event) if event.type == pygame.QUIT: running = False if event.type == pygame.KEYDOWN or event.type == pygame.KEYUP: command = SetPosition(client_player, client_player.x, client_player.y) game_queue.put(command) client.send_message([1, command.serialize()]) binding.update_keystate() for command in binding.get_commands(): if command is not None: game_queue.put(command) print(command.serialize()) client.send_message([1, command.serialize()]) while not game_queue.empty(): command = game_queue.get() command.execute() game_board.update() board_surface = draw_board(game_board) for player in players.values(): player.update() board_surface = draw_player(board_surface, player) board_surface = pygame.transform.scale(board_surface, (WIDTH, HEIGHT)) screen.blit(board_surface, (0, 0)) screen.blit(update_fps(), (10, 0)) [menu.draw() for menu in menus] pygame.display.update() screen.fill((16, 120, 48)) clock.tick(60) print("broken") client.close() print("CLOSED") pygame.quit() print("QUIT")
for stat in memory_diff: delta_memory = delta_memory + stat.size_diff # de Byte -> kByte delta_memory = delta_memory / 1024.0 return delta_memory """ Menu principal """ while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: print("Cargando información de los archivos ....") catalog = controller.init() rtas = controller.loadData(catalog) primerVertice = rtas[0] ultimoPais = rtas[1] numCountries = controller.totalLandingPoints(catalog) numLanding = controller.numeroPoints(catalog) numConexiones = controller.totalConexiones(catalog) # numConexiones = controller.totalConexiones(catalog) print('Total de landing points: ' + str(numLanding)) print('Total de conexiones: ' + str(numConexiones)) print('Total de Paises: ' + str(numCountries)) print('Primer landing points cargados: ' + primerVertice['landing_point_id'] + ' || ' + primerVertice['name'] + ' || ' + primerVertice['latitude'] +
user_track="user_track_hashtag_timestamp-small.csv" sentiment = "sentiment_values.csv" # arreglar esto dicci = None """ Menu principal """ while True: printMenu() inputs = input('Seleccione una opción para continuar\n') if int(inputs[0]) == 1: print("Cargando información de los archivos ....") dicci=controller.init() info = controller.init2() diccio = controller.init3() diccion = controller.init4() d = controller.init5() elif int(inputs[0]) == 2: controller.loadData(dicci,crimesfile) #arboles por caracteristicas de evento t = controller.loadData2(info,crimesfile) # arbol organizado por tempo f = controller.loadData3(diccio,crimesfile) #arbol organizado por fecha d = controller.loadData4(d,user_track) y = controller.loadData5(diccion,sentiment) #arbol por vader prom print('Crimenes cargados: ' + str(controller.loadHeight(dicci))) print('Crimenes cargados: ' + str(controller.loadSize(dicci)))