Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # -*- coding: utf-8 -*-
- #
- import pickle
- import os.path
- # nome do time, pontuacao, gols marcados, gols sofridos
- selecao = [
- [
- ['BRASIL', 0, 0, 0], ['CROACIA', 0, 0, 0], ['MEXICO', 0, 0, 0], ['CAMAROES', 0, 0, 0, ]
- ], [
- ['ESPANHA', 0, 0, 0], ['HOLANDA', 0, 0, 0], ['CHILE', 0, 0, 0], ['AUSTRALIA', 0, 0, 0]
- ], [
- ['COLOMBIA', 0, 0, 0], ['GRECIA', 0, 0, 0], ['C. DO MARFIM', 0, 0, 0], ['JAPÃO', 0, 0, 0]
- ], [
- ['URUGUAI', 0, 0, 0], ['COSTA RICA', 0, 0, 0], ['INGLATERRA', 0, 0, 0], ['ITÁLIA', 0, 0, 0]
- ], [
- ['SUIÇA', 0, 0, 0], ['EQUADOR', 0, 0, 0], ['FRANÇA', 0, 0, 0], ['HONDURAS', 0, 0, 0]
- ], [
- ['ARGENTINA', 0, 0, 0], ['BOSNIA', 0, 0, 0], ['IRA', 0, 0, 0], ['NIGERIA', 0, 0, 0]
- ], [
- ['ALEMANHA', 0, 0, 0], ['PORTUGAL', 0, 0, 0], ['GANA', 0, 0, 0], ['EUA', 0, 0, 0]
- ], [
- ['BELGICA', 0, 0, 0], ['ARGELIA', 0, 0, 0], ['RÚSSIA', 0, 0, 0], ['C. DO SUL', 0, 0, 0]
- ]
- ]
- times_oitavas = []
- times_quartas = []
- times_semifinais = []
- # TODO o array de cidades, ele é praticamente inútil
- cid = ['FORTALEZA', 'NATAL', 'RECIFE', 'SALVADOR', 'BRASÍLIA', 'BELO HORIZONTE', 'SÃO PAULO',
- 'CUIABÁ', 'MANAUS', 'RIO DE JANEIRO', 'CURITIBA', 'PORTO ALEGRE']
- grupos = [
- [ # grupo A
- [selecao[0][0], selecao[0][1], '12/06/2014', 'Quinta-Feira', '16:00h', cid[6], 3, 2],
- [selecao[0][2], selecao[0][3], '13/06/2014', 'Sexta-Feira', '13:00h', cid[1], 5, 0],
- [selecao[0][0], selecao[0][2], '17/06/2014', 'Terça-Feira', '16:00h', cid[0], 2, 1],
- [selecao[0][3], selecao[0][1], '18/06/2014', 'Quarta-Feira', '19:00h', cid[8], 3, 3],
- [selecao[0][1], selecao[0][2], '23/06/2014', 'Segunda-Feira', '17:00h', cid[2], 2, 0],
- [selecao[0][3], selecao[0][0], '23/06/2014', 'Segunda-Feira', '17:00h', cid[4], 0, 0]
- ], [ # grupo B
- [selecao[1][0], selecao[1][1], '13/06/2014', 'Sexta-Feira', '16:00h', cid[3], 1, 4],
- [selecao[1][2], selecao[1][3], '13/06/2014', 'Sexta-Feira', '19:00h', cid[7], 4, 6],
- [selecao[1][0], selecao[1][2], '18/06/2014', 'Quarta-Feira', '13:00h', cid[11], 1, 1],
- [selecao[1][3], selecao[1][1], '18/06/2014', 'Quarta-Feira', '16:00h', cid[9], 0, 7],
- [selecao[1][1], selecao[1][2], '23/06/2014', 'Segunda-Feira', '13:00h', cid[10], 2, 2],
- [selecao[1][3], selecao[1][0], '23/06/2014', 'Segunda-Feira', '13:00h', cid[6], 1, 1]
- ], [ # grupo C
- [selecao[2][0], selecao[2][1], '14/06/2014', 'Sábado', '13:00h', cid[5], 10, 0],
- [selecao[2][2], selecao[2][3], '14/06/2014', 'Sábado', '22:00h', cid[2], 4, 2],
- [selecao[2][0], selecao[2][2], '19/06/2014', 'Quinta-feira', '13:00h', cid[4], 2, 1],
- [selecao[2][3], selecao[2][1], '19/06/2014', 'Quinta-feira', '19:00h', cid[1], 1, 1],
- [selecao[2][1], selecao[2][2], '24/06/2014', 'Terça-Feira', '17:00h', cid[7], 3, 7],
- [selecao[2][3], selecao[2][0], '24/06/2014', 'Terça-Feira', '17:00h', cid[0], 0, 0]
- ], [ # grupo D
- [selecao[3][0], selecao[3][1], '14/06/2014', 'Sábado', '16:00h', cid[0], 0, 1],
- [selecao[3][2], selecao[3][3], '14/06/2014', 'Sábado', '19:00h', cid[8], 0, 2],
- [selecao[3][0], selecao[3][2], '19/06/2014', 'Quinta-feira', '16:00h', cid[6], 0, 3],
- [selecao[3][3], selecao[3][1], '20/06/2014', 'Sexta-feira', '13:00h', cid[2], 0, 4],
- [selecao[3][1], selecao[3][2], '24/06/2014', 'Terça-Feira', '13:00h', cid[1], 0, 5],
- [selecao[3][3], selecao[3][0], '24/06/2014', 'Terça-Feira', '13:00h', cid[5], 0, 6]
- ], [ # grupo E
- [selecao[4][0], selecao[4][1], '15/06/2014', 'Domingo', '13:00h', cid[4], 0, 0],
- [selecao[4][2], selecao[4][3], '15/06/2014', 'Domingo', '16:00h', cid[11], 1, 1],
- [selecao[4][0], selecao[4][2], '20/06/2014', 'Sexta-feira', '16:00h', cid[3], 2, 3],
- [selecao[4][3], selecao[4][1], '20/06/2014', 'Sexta-feira', '19:00h', cid[10], 0, 0],
- [selecao[4][1], selecao[4][2], '25/06/2014', 'Quarta-Feira', '17:00h', cid[8], 5, 2],
- [selecao[4][3], selecao[4][0], '25/06/2014', 'Quarta-Feira', '17:00h', cid[9], 3, 6]
- ], [ # grupo F
- [selecao[5][0], selecao[5][1], '15/06/2014', 'Domingo', '19:00h', cid[9], 0, 1],
- [selecao[5][2], selecao[5][3], '16/06/2014', 'Segunda-Feira', '16:00h', cid[10], 1, 1],
- [selecao[5][0], selecao[5][2], '21/06/2014', 'Sábado', '13:00h', cid[5], 1, 2],
- [selecao[5][3], selecao[5][1], '21/06/2014', 'Sábado', '19:00h', cid[7], 1, 0],
- [selecao[5][1], selecao[5][2], '25/06/2014', 'Quarta-Feira', '13:00h', cid[3], 2, 1],
- [selecao[5][3], selecao[5][0], '25/06/2014', 'Quarta-Feira', '13:00h', cid[11], 8, 1]
- ], [ # grupo G
- [selecao[6][0], selecao[6][1], '16/06/2014', 'Segunda-Feira', '13:00h', cid[3], 2, 1],
- [selecao[6][2], selecao[6][3], '16/06/2014', 'Segunda-Feira', '19:00h', cid[1], 1, 3],
- [selecao[6][0], selecao[6][2], '21/06/2014', 'Sábado', '16:00h', cid[0], 4, 1],
- [selecao[6][3], selecao[6][1], '22/06/2014', 'Domingo', '19:00h', cid[8], 1, 5],
- [selecao[6][1], selecao[6][2], '26/06/2014', 'Quinta-Feira', '13:00h', cid[4], 6, 1],
- [selecao[6][3], selecao[6][0], '26/06/2014', 'Quinta-Feira', '13:00h', cid[2], 7, 1]
- ], [ # grupo H
- [selecao[7][0], selecao[7][1], '17/06/2014', 'Terça-Feira', '13:00h', cid[5], 4, 2],
- [selecao[7][2], selecao[7][3], '17/06/2014', 'Terça-Feira', '19:00h', cid[7], 2, 1],
- [selecao[7][0], selecao[7][2], '22/06/2014', 'Domingo', '13:00h', cid[9], 1, 5],
- [selecao[7][3], selecao[7][1], '22/06/2014', 'Domingo', '16:00h', cid[11], 2, 2],
- [selecao[7][1], selecao[7][2], '26/06/2014', 'Quinta-Feira', '17:00h', cid[10], 0, 0],
- [selecao[7][3], selecao[7][0], '26/06/2014', 'Quinta-Feira', '17:00h', cid[6], 1, 8]
- ]
- ]
- #
- # grupos = [
- # [ # grupo A
- # [selecao[0][0], selecao[0][1], '12/06/2014', 'Quinta-Feira', '16:00h', cid[6], '__', '__'],
- # [selecao[0][2], selecao[0][3], '13/06/2014', 'Sexta-Feira', '13:00h', cid[1], '__', '__'],
- # [selecao[0][0], selecao[0][2], '17/06/2014', 'Terça-Feira', '16:00h', cid[0], '__', '__'],
- # [selecao[0][3], selecao[0][1], '18/06/2014', 'Quarta-Feira', '19:00h', cid[8], '__', '__'],
- # [selecao[0][1], selecao[0][2], '23/06/2014', 'Segunda-Feira', '17:00h', cid[2], '__', '__'],
- # [selecao[0][3], selecao[0][0], '23/06/2014', 'Segunda-Feira', '17:00h', cid[4], '__', '__']
- # ], [ # grupo B
- # [selecao[1][0], selecao[1][1], '13/06/2014', 'Sexta-Feira', '16:00h', cid[3], '__', '__'],
- # [selecao[1][2], selecao[1][3], '13/06/2014', 'Sexta-Feira', '19:00h', cid[7], '__', '__'],
- # [selecao[1][0], selecao[1][2], '18/06/2014', 'Quarta-Feira', '13:00h', cid[11], '__', '__'],
- # [selecao[1][3], selecao[1][1], '18/06/2014', 'Quarta-Feira', '16:00h', cid[9], '__', '__'],
- # [selecao[1][1], selecao[1][2], '23/06/2014', 'Segunda-Feira', '13:00h', cid[10], '__', '__'],
- # [selecao[1][3], selecao[1][0], '23/06/2014', 'Segunda-Feira', '13:00h', cid[6], '__', '__']
- # ], [ # grupo C
- # [selecao[2][0], selecao[2][1], '14/06/2014', 'Sábado', '13:00h', cid[5], '__', '__'],
- # [selecao[2][2], selecao[2][3], '14/06/2014', 'Sábado', '22:00h', cid[2], '__', '__'],
- # [selecao[2][0], selecao[2][2], '19/06/2014', 'Quinta-feira', '13:00h', cid[4], '__', '__'],
- # [selecao[2][3], selecao[2][1], '19/06/2014', 'Quinta-feira', '19:00h', cid[1], '__', '__'],
- # [selecao[2][1], selecao[2][2], '24/06/2014', 'Terça-Feira', '17:00h', cid[7], '__', '__'],
- # [selecao[2][3], selecao[2][0], '24/06/2014', 'Terça-Feira', '17:00h', cid[0], '__', '__']
- # ], [ # grupo D
- # [selecao[3][0], selecao[3][1], '14/06/2014', 'Sábado', '16:00h', cid[0], '__', '__'],
- # [selecao[3][2], selecao[3][3], '14/06/2014', 'Sábado', '19:00h', cid[8], '__', '__'],
- # [selecao[3][0], selecao[3][2], '19/06/2014', 'Quinta-feira', '16:00h', cid[6], '__', '__'],
- # [selecao[3][3], selecao[3][1], '20/06/2014', 'Sexta-feira', '13:00h', cid[2], '__', '__'],
- # [selecao[3][1], selecao[3][2], '24/06/2014', 'Terça-Feira', '13:00h', cid[1], '__', '__'],
- # [selecao[3][3], selecao[3][0], '24/06/2014', 'Terça-Feira', '13:00h', cid[5], '__', '__']
- # ], [ # grupo E
- # [selecao[4][0], selecao[4][1], '15/06/2014', 'Domingo', '13:00h', cid[4], '__', '__'],
- # [selecao[4][2], selecao[4][3], '15/06/2014', 'Domingo', '16:00h', cid[11], '__', '__'],
- # [selecao[4][0], selecao[4][2], '20/06/2014', 'Sexta-feira', '16:00h', cid[3], '__', '__'],
- # [selecao[4][3], selecao[4][1], '20/06/2014', 'Sexta-feira', '19:00h', cid[10], '__', '__'],
- # [selecao[4][1], selecao[4][2], '25/06/2014', 'Quarta-Feira', '17:00h', cid[8], '__', '__'],
- # [selecao[4][3], selecao[4][0], '25/06/2014', 'Quarta-Feira', '17:00h', cid[9], '__', '__']
- # ], [ # grupo F
- # [selecao[5][0], selecao[5][1], '15/06/2014', 'Domingo', '19:00h', cid[9], '__', '__'],
- # [selecao[5][2], selecao[5][3], '16/06/2014', 'Segunda-Feira', '16:00h', cid[10], '__', '__'],
- # [selecao[5][0], selecao[5][2], '21/06/2014', 'Sábado', '13:00h', cid[5], '__', '__'],
- # [selecao[5][3], selecao[5][1], '21/06/2014', 'Sábado', '19:00h', cid[7], '__', '__'],
- # [selecao[5][1], selecao[5][2], '25/06/2014', 'Quarta-Feira', '13:00h', cid[3], '__', '__'],
- # [selecao[5][3], selecao[5][0], '25/06/2014', 'Quarta-Feira', '13:00h', cid[11], '__', '__']
- # ], [ # grupo G
- # [selecao[6][0], selecao[6][1], '16/06/2014', 'Segunda-Feira', '13:00h', cid[3], '__', '__'],
- # [selecao[6][2], selecao[6][3], '16/06/2014', 'Segunda-Feira', '19:00h', cid[1], '__', '__'],
- # [selecao[6][0], selecao[6][2], '21/06/2014', 'Sábado', '16:00h', cid[0], '__', '__'],
- # [selecao[6][3], selecao[6][1], '22/06/2014', 'Domingo', '19:00h', cid[8], '__', '__'],
- # [selecao[6][1], selecao[6][2], '26/06/2014', 'Quinta-Feira', '13:00h', cid[4], '__', '__'],
- # [selecao[6][3], selecao[6][0], '26/06/2014', 'Quinta-Feira', '13:00h', cid[2], '__', '__']
- # ], [ # grupo H
- # [selecao[7][0], selecao[7][1], '17/06/2014', 'Terça-Feira', '13:00h', cid[5], '__', '__'],
- # [selecao[7][2], selecao[7][3], '17/06/2014', 'Terça-Feira', '19:00h', cid[7], '__', '__'],
- # [selecao[7][0], selecao[7][2], '22/06/2014', 'Domingo', '13:00h', cid[9], '__', '__'],
- # [selecao[7][3], selecao[7][1], '22/06/2014', 'Domingo', '16:00h', cid[11], '__', '__'],
- # [selecao[7][1], selecao[7][2], '26/06/2014', 'Quinta-Feira', '17:00h', cid[10], '__', '__'],
- # [selecao[7][3], selecao[7][0], '26/06/2014', 'Quinta-Feira', '17:00h', cid[6], '__', '__']
- # ]
- # ]
- oitavas = [
- [' ', ' ', '28/06/2014', 'Sábado', '13:00h', cid[5], 1, 0 ],
- [' ', ' ', '28/06/2014', 'Sábado', '17:00h', cid[6], 2, 0 ],
- [' ', ' ', '30/06/2014', 'Segunda-Feira', '13:00h', cid[5], 0, 0],
- [' ', ' ', '30/06/2014', 'Segunda-Feira', '17:00h', cid[5], 2, 3 ],
- [' ', ' ', '29/06/2014', 'Domingo', '13:00h', cid[0], 1, 3 ],
- [' ', ' ', '29/06/2014', 'Domingo', '17:00h', cid[2], 3, 3 ],
- [' ', ' ', '01/07/2014', 'Terça-Feira', '13:00h', cid[6], 1, 1],
- [' ', ' ', '01/07/2014', 'Terça-Feira', '17:00h', cid[5], 4, 1]
- ]
- quartas = [
- [' ', ' ', '04/07/2014', 'Sexta-Feira', '17:00h', cid[0], '__', '__' ],
- [' ', ' ', '04/07/2014', 'Sexta-Feira', '13:00h', cid[9], '__', '__'],
- [' ', ' ', '05/07/2014', 'Sábado', '17:00h', cid[5], '__', '__'],
- [' ', ' ', '05/07/2014', 'Sábado', '13:00h', cid[5], '__', '__']
- ]
- semifinal = [
- [' ', ' ', '08/07/2014', 'Terça-Feira', '17:00h', cid[5], '__', '__' ],
- [' ', ' ', '09/07/2014', 'Quarta-Feira', '17:00h', cid[6], '__', '__' ]
- ]
- terceiro_e_quarto = [' ', ' ', '12/07/2014', 'Sábado', '17:00h', cid[4], '__', '__' ]
- disputa_final = [' ', ' ', '13/07/2014', 'Domingo', '17:00h', cid[9], '__', '__' ]
- objetos = [selecao, times_oitavas, times_quartas, times_semifinais, cid, grupos, oitavas, quartas, semifinal, terceiro_e_quarto, disputa_final]
- grps = ["A", "B", "C", "D", "E", "F", "G", "H"]
- # nome do time, pontuacao, gols marcados, gols sofridos, saldo de gols
- def print_tabela_pontos():
- g = ["A", "B", "C", "D", "E", "F", "G", "H"]
- for n in range(len(selecao)):
- print("Grupo {}:".format(g[n]))
- for i in selecao[n]:
- s = "seleção: {:<15}, pontos: {}, gols marcados: {}, gols sofridos: {} saldo de gols: {}"
- print(s.format(i[0], i[1], i[2], i[3], i[2] - i[3]))
- # seleção 1, seleção 2, data, dia semana, hora, cidade, r1, r2
- def print_partida(p, n=""):
- # Brasil 3 X Croácia 2, Quinta-Feira às 16:00h, 12/06/2014 em São Paulo
- s = "{} {} {} X {} {}, {} às {}, {} em {}"
- s = s.format(n, p[0][0], p[6], p[1][0], p[7], p[3], p[4], p[2], p[5])
- print(s)
- def pts(a, b):
- return b[1] - a[1]
- def atualiza_oitavas():
- # ordena cada grupo pelos pontos marcados
- for g in range(len(selecao)):
- selecao[g] = sorted(selecao[g], cmp=pts)
- # http://stackoverflow.com/questions/1400608/how-to-empty-a-list-in-python
- times_oitavas[:] = []
- # 1º Grupo A x 2º Grupo B
- oitavas[0][0] = selecao[0][0]
- oitavas[0][1] = selecao[1][1]
- times_oitavas.append([selecao[0][0], selecao[1][1]]) # p81
- # 1º Grupo C x 2º Grupo D
- oitavas[1][0] = selecao[2][0]
- oitavas[1][1] = selecao[3][1]
- times_oitavas.append([selecao[2][0], selecao[3][1]]) # p82
- # 1º Grupo B x 2º Grupo A
- oitavas[2][0] = selecao[1][0]
- oitavas[2][1] = selecao[0][1]
- times_oitavas.append([selecao[1][0], selecao[0][1]]) # p83
- # 1º Grupo D x 2º Grupo C
- oitavas[3][0] = selecao[3][0]
- oitavas[3][1] = selecao[2][1]
- times_oitavas.append([selecao[3][0], selecao[2][1]]) # p84
- # 1º Grupo E x 2º Grupo F
- oitavas[4][0] = selecao[4][0]
- oitavas[4][1] = selecao[5][1]
- times_oitavas.append([selecao[4][0], selecao[5][1]]) # p85
- # 1º Grupo G x 2º Grupo H
- oitavas[5][0] = selecao[6][0]
- oitavas[5][1] = selecao[7][1]
- times_oitavas.append([selecao[6][0], selecao[7][1]]) # p86
- # 1º Grupo F x 2º Grupo E
- oitavas[6][0] = selecao[5][0]
- oitavas[6][1] = selecao[4][1]
- times_oitavas.append([selecao[5][0], selecao[4][1]]) # p87
- # 1º Grupo H x 2º Grupo G
- oitavas[7][0] = selecao[7][0]
- oitavas[7][1] = selecao[6][1]
- times_oitavas.append([selecao[7][0], selecao[6][1]]) # p88
- def atualiza_quartas():
- # ordena os grupos de oitava pelos pontos marcados
- for g in range(len(times_oitavas)):
- times_oitavas[g] = sorted(times_oitavas[g], cmp=pts)
- times_quartas[:] = []
- # Vencedor 5 x Vencedor 6
- quartas[0][0] = times_oitavas[4][0]
- quartas[0][1] = times_oitavas[5][0]
- times_quartas.append([times_oitavas[4][0], times_oitavas[5][0]])
- # Vencedor 1 x Vencedor 2
- quartas[1][0] = times_oitavas[0][0]
- quartas[1][1] = times_oitavas[1][0]
- times_quartas.append([times_oitavas[0][0], times_oitavas[1][0]])
- # Vencedor 7 x Vencedor 8
- quartas[2][0] = times_oitavas[6][0]
- quartas[2][1] = times_oitavas[7][0]
- times_quartas.append([times_oitavas[6][0], times_oitavas[7][0]])
- # Vencedor 3 x Vencedor 4
- quartas[3][0] = times_oitavas[2][0]
- quartas[3][1] = times_oitavas[3][0]
- times_quartas.append([times_oitavas[2][0], times_oitavas[3][0]])
- def atualiza_semifinal():
- # ordena os grupos de oitava pelos pontos marcados
- for g in range(len(times_quartas)):
- times_quartas[g] = sorted(times_quartas[g], cmp=pts)
- times_semifinais[:] = []
- # Vencedor Q1 x Vencedor Q2
- semifinal[0][0] = times_quartas[0][0]
- semifinal[0][1] = times_quartas[1][0]
- times_semifinais.append([times_quartas[0][0], times_quartas[1][0]])
- # Vencedor Q3 x Vencedor Q4
- semifinal[1][0] = times_quartas[2][0]
- semifinal[1][1] = times_quartas[3][0]
- times_semifinais.append([times_quartas[2][0], times_quartas[3][0]])
- def atualiza_terceiro_e_final():
- # ordena os grupos de oitava pelos pontos marcados
- for g in range(len(times_semifinais)):
- times_semifinais[g] = sorted(times_semifinais[g], cmp=pts)
- terceiro_e_quarto[0] = times_semifinais[0][1]
- terceiro_e_quarto[1] = times_semifinais[1][1]
- disputa_final[0] = times_semifinais[0][0]
- disputa_final[1] = times_semifinais[1][0]
- def tem_oitavas():
- for g in range(len(grupos)):
- for h in range(len(grupos[g])):
- if grupos[g][h][6] == '__' or grupos[g][h][7] == '__' :
- return False
- return True
- def tem_quartas():
- for g in range(len(oitavas)):
- if oitavas[g][6] == '__' or oitavas[g][7] == '__' :
- return False
- return True
- def tem_semifinal():
- for g in range(len(quartas)):
- if quartas[g][6] == '__' or quartas[g][7] == '__' :
- return False
- return True
- def tem_terceiro_e_final():
- for g in range(len(semifinal)):
- if semifinal[g][6] == '__' or semifinal[g][7] == '__' :
- return False
- return True
- def resultado_partida(prt):
- print("Informe o resultado para {}".format(prt[0][0]))
- r1 = int(input())
- print("Informe o resultado para {}".format(prt[1][0]))
- r2 = int(input())
- prt[0][2] = prt[0][2] + r1
- prt[0][3] = prt[0][3] + r2
- prt[1][2] = prt[1][2] + r2
- prt[1][3] = prt[1][3] + r1
- prt[6] = r1
- prt[7] = r2
- if r1 == r2:
- prt[0][1] = prt[0][1] + 1
- prt[1][1] = prt[1][1] + 1
- elif r1 > r2:
- prt[0][1] = prt[0][1] + 3
- else:
- prt[1][1] = prt[1][1] + 3
- def print_resultado():
- # atualiza
- atualiza_tabelas()
- for g in range(len(grps)):
- print("\r\nGrupo {}:".format(grps[g]))
- for p in grupos[g]:
- print_partida(p)
- if tem_oitavas():
- print("\r\nOitavas:")
- for g in range(len(oitavas)):
- print_partida(oitavas[g])
- if tem_quartas():
- print("\r\nQuartas:")
- for g in range(len(quartas)):
- print_partida(quartas[g])
- if tem_semifinal():
- print("Semifinal:")
- for g in range(len(semifinal)):
- print_partida(semifinal[g])
- if tem_terceiro_e_final():
- print("Disputa do terceiro lugar:")
- print_partida(terceiro_e_quarto)
- print("Final:")
- print_partida(disputa_final)
- def atualiza_tabelas():
- if tem_oitavas():
- atualiza_oitavas()
- if tem_quartas():
- atualiza_quartas()
- if tem_semifinal():
- atualiza_semifinal()
- if tem_terceiro_e_final():
- atualiza_terceiro_e_final()
- def print_grupos():
- # menu básico
- print("Informe o grupo:")
- for g in range(len(grps)):
- print("{}. Grupo {}".format(g + 1, grps[g]))
- if tem_oitavas():
- print("9. Oitavas de final")
- if tem_quartas():
- print("10. Quartas de final")
- if tem_semifinal():
- print("11. Semifinal")
- if tem_terceiro_e_final():
- print("12. Terceiro lugar")
- print("13. Final")
- # descobrindo a opção do usuário
- op = input()
- if op < 9:
- grp = grupos[op - 1]
- elif op == 9:
- grp = oitavas
- elif op == 10:
- grp = quartas
- elif op == 11:
- grp = semifinal
- for i in range(len(grp)):
- print_partida(grp[i], i)
- print("Informe a partida:")
- op = int(input())
- # processando
- resultado_partida(grp[op])
- # atualiza
- atualiza_tabelas()
- def recarrega():
- if os.path.isfile("jogos.ser"):
- objetos = pickle.load("jogos.ser")
- selecao = objetos[0]
- times_oitavas = objetos[1]
- times_quartas = objetos[2]
- times_semifinais = objetos[3]
- cid = objetos[4]
- grupos = objetos[5]
- oitavas = objetos[6]
- quartas = objetos[7]
- semifinal = objetos[8]
- terceiro_e_quarto = objetos[9]
- disputa_final = objetos[10]
- def menu():
- op = 1
- while op > -1:
- print("1. Ver resultados")
- print("2. Ver tabela de pontos dos times")
- print("3. Inserir resultado")
- print("4. Sair")
- print("op: ")
- op = int(input())
- if op == 1:
- print_resultado()
- elif op == 2:
- print_tabela_pontos()
- elif op == 3:
- print_grupos()
- else:
- print("Saindo....")
- op = -1
- recarrega()
- menu()
- # print_partida(grupos[0][0])
Add Comment
Please, Sign In to add comment