def show(data: list): """ param data: lista que contém grupos """ #Apresentação first = len(data[0]) if first != 2: cont = 0 #for c in data: #dly(1.25) #print(f'Grupo {A0Z25[cont]}:') #for b in range(len(c)): #dly(0.5) #print(f'{b+1}.{c[b][0]}') #cont += 1 #print('') cont = 0 meio = int(len(data) / 2) blocos = 8 for c in range(0, len(data), blocos): dly(1.25) for a in range(blocos): print(f' Grupo {A0Z25[c+a]}:' if a == 0 else f' Grupo {A0Z25[c + a]}:', end='') print('') for b in range(len(data[c])): dly(0.5) for oth in range(blocos): print(f'{b+1}.{data[c + oth][b][0]:<10}', end=' ') print('') cont += 1 print('') else: if len(data) == 2: print('Semi Final') pass elif len(data) == 1: print('Final') pass else: print(f'{len(data)}ᵃ de Final') pass for c in range(len(data)): dly(1) print(f'{c+1}°Jogo: {data[c][0][0]} vs. {data[c][1][0]}') print('')
from time import sleep as dly from smbus2 import SMBus import numpy as np I2C_ADDR = 104 PWR_MNG_REG = 107 STARTING_REG = 65 with SMBus(1) as bus: bus.write_byte_data(I2C_ADDR, PWR_MNG_REG, 0) dly(1) def comb_bytes(inb1, inb2): inb1 = inb1 & 127 #print(bin(inb1)) #print(bin(inb2)) outb = inb1 << 8 | inb2 print(outb) temp = (outb / 340.00) + 36.53 print(temp) return temp def temperature(inv1, inv2): #print(bin(inv1), "|", inv2) #print(type(np.uint16(inv1)), "|", np.uint16(inv2)) #inval = np.uint16(inv1) << 8 | np.uint16(inv2) inval = inv1 << 8 | inv2 temp = (np.int16(inval) / 340.00) + 36.53 #temp = (inval / 340.00) + 36.53
def tatakau(data: list, assistido: bool = True): for a in range(len(data)): camp = data[a].copy() print(f'Disputas Grupo {A0Z25[a]}' if assistido else '') #info(f"Grupo {A0Z25[a]}") for c in range(len(camp)): op = camp[c + 1:len(camp)].copy() for b in range(len(op)): res = [0, 0] print(f'{camp[c][0]} vs. {op[b][0]}' if assistido else '') while res[0] == res[1]: res = [rd(min_range, max_range), rd(min_range, max_range)] if assistido: dly(1.5) if res[0] > res[1]: camp[c][1] += 1 print( emoji.emojize(f' {camp[c][0]} vence! \n' ) if assistido else '') else: camp[c + b + 1][1] += 1 if assistido: print( emoji.emojize(f' {camp[c+b+1][0]} vence! \n' ) if assistido else '') if assistido: dly(1) camp.sort(key=pto, reverse=True) data[a] = camp.copy() if assistido: for c in range(len(camp)): print(f'{c+1}. {camp[c][0]} {camp[c][1]}') print('') dly(1) pontos = [] for c in camp: pontos.append(c[1]) if pontos.count(1) == 3 or pontos.count(2) == 3 and len( pontos) != 3 or pontos.count(2) == 2 and pontos[0] == 3: desempate = 0 while pontos.count(1) == 3 or pontos.count(2) == 3 and len( pontos) != 3 or pontos.count(2) == 2 and pontos[0] == 3: desempate += 1 if pontos.count(1) == 3 and len(pontos) != 3: #logger.info("if pontos.count(1) == 3 and len(pontos) != 3:") camp = data[a][1:].copy() elif pontos.count(2) == 3 and len(pontos) != 3: #logger.info("elif pontos.count(2) == 3 and len(pontos) != 3:") camp = data[a][:3].copy() elif pontos.count(2) == 2 and pontos[0] == 3: #logger.info("elif pontos.count(2) == 2 and pontos[0] == 3:") camp = data[a][1:3].copy() for x in range(len(camp)): camp[x][1] = 0 print(f'Desempate {desempate} Grupo {A0Z25[a]}' if assistido else '') #info(f'Desempate {desempate}') #logger.info(f"{camp} - 1") for c in range(len(camp)): op = camp[c + 1:len(camp)].copy() for b in range(len(op)): res = [0, 0] print( emoji.emojize(f'{camp[c][0]} vs. {op[b][0]}' ) if assistido else '') while res[0] == res[1]: res = [ rd(min_range, max_range), rd(min_range, max_range) ] if res[0] == res[1]: if assistido: print("Empate! Jogando de novo!") dly(3) if assistido: dly(3) if res[0] > res[1]: camp[c][1] += 1 print( emoji.emojize(f'{camp[c][0]} vence!\n' ) if assistido else '') else: camp[c + b + 1][1] += 1 print( emoji.emojize(f'{camp[c+b+1][0]} vence!\n' ) if assistido else '') if assistido: dly(1) camp.sort(key=pto, reverse=True) #logger.info(f"{camp} - 2") if assistido: print(f'Desempate {desempate} Grupo {A0Z25[a]}') for c in range(len(camp)): print(f'{c+2}. {camp[c][0]} {camp[c][1]}') print('') pontos = [] if pontos.count(1) == 3 and len(pontos) != 3: #logger.info("if pontos.count(1) == 3 and len(pontos) != 3:") #camp = data[a][1:].copy() for c in range(len(camp)): data[c + 1] = camp[c] elif pontos.count(2) == 3 and len(pontos) != 3: #logger.info("elif pontos.count(2) == 3 and len(pontos) != 3:") # camp = data[a][:3].copy() for c in range(len(camp)): data[c] = camp[c] elif pontos.count(2) == 2 and pontos[0] == 3: #logger.info("elif pontos.count(2) == 2 and pontos[0] == 3:") # camp = data[a][1:3].copy() for c in range(len(camp)): data[c + 1] = camp[c] if assistido: dly(1) else: #info("Passou direto, sem empates") pass if assistido: dly(1) return data
g.append(a[al]) a.remove(a[al]) div.append(g) if len(a) != 0: div.append(a) a = [] ''' método qdo div com grupos divididos for jog in a: for cont in range(100): g = rd(0,len(div)-1) #g = int(input(f'{jog} vai pra: '))-1 if len(div[g]) == 8: pass else: div[g].append(jog) break ''' cont = 0 for c in div: dly(1) print(f'Grupo {A0Z25[cont]}:') for b in range(len(c)): dly(2) print(f'{b+1}.{c[b][0]}') cont += 1 print('')
g = [] for c in range(integrantes): #4 = integrantes nos grupos if not len(a) == 0: al = rd(0, len(a) - 1) else: al = 0 g.append(a[al]) a.remove(a[al]) data.append(g) if len(a) != 0: data.append(a) a = [] cont = 0 for c in data: dly(1) print(f'Grupo {A0Z25[cont]}:') for b in range(len(c)): dly(0.5) print(f'{b+1}.{c[b][0]}') cont += 1 print('') pto = lambda ponto: ponto[1] for a in range(len(data)): camp = data[a].copy() print(f'Disputas Grupo {A0Z25[a]}') for c in range(len(camp)): op = camp[c + 1:len(camp)].copy() for b in range(len(op)): res = [0, 0]