Probabilidade de Vencer - Poker Texas Hold
Publicado por RCAA 08/01/2009
[ Hits: 9.858 ]
Este script calcula a probabilidade de se vencer em um jogo de poker Texas Hold'em contra somente um adversário.
O script só funciona em velocidade aceitável se houver um número suficiente de informações. No meu poderoso duron 750mhz ele faz mais ou menos 100 "iterações" por segundo.
A princípio eu tentei fazer com orientação a objetos, mas não deu certo... Por favor, caso alguém tenha alguma sugestão de melhoria de desempenho me comunique!
#!/usr/bin/python
#-*- coding: iso8859-1 -*-
#Por RCAA (mySOsMADEofSLACK)
#
# 29/12/08 -> Início
# 30/12~2/12 -> Reveillon xD
# 04/01/09 -> Terminado o Grosso
# 05/01/09 - > Ajustes finais
# 06/01/09 -> (Bug fixes e) Versão atual
#
def showcd(card):#Mostra uma carta de um modo mais intuitivo
naipes=["Ouros","Paus","Copas","Espadas"]
valores=["inv","inv","2","3","4","5","6","7","8","9","10","Valete","Dama","Rei","Ás"]
return valores[card[0]] + " de " + naipes[card[1]]
def drwcd(deck,num=" "):#retira uma carta do baralho 'deck' escolhida pelo user, fazendo consistência de dados
card=[-1,-1]
while (not card in deck):
while (card[0]<2 or card[0]>14):
if card[0]!= -1: print " Valor inválido, consulte a legenda!"
try:
card[0]=abs(int(raw_input(" Valor da"+num+"carta:")))
except ValueError:
print " O valor deve ser um número conforme a legenda!"
while card[1]<0 or card[1]>3:
if card[1]!= -1: print "Valor inválido, consulte a legenda!"
try:
card[1]=abs(int(raw_input(" Naipe da"+num+"carta:")))
except ValueError:
print " O valor deve ser um número conforme a legenda!"
if not card in deck:
print " A carta "+showcd(card)+" já foi escolhida, escolha outra:"
card=[-1,-1]
deck.remove(card)
return card
def perg(texto,t_resp,numerica=1):#faz uma pergunta 'texto', sem aceitar resposta diferente de um item de t_resp
resp=-1
while not resp in t_resp:
if resp!=-1: print "Resposta Inválida..."
print texto
if numerica==1:
try:
resp = int(raw_input())
except ValueError:
resp=-2
else:
try:
resp = raw_input()
except ValueError:
pass
return resp
def is_stflu(cards):#Verifica se um dado conjunto ordenado 'cards' de tamanho 5 é um straight flush
if (cards[0][1]==cards[1][1]==cards[2][1]==cards[3][1]==cards[4][1]) and (cards[0][0]+4==cards[1][0]+3==cards[2][0]+2==cards[3][0]+1==cards[4][0]):
return 1
if (cards[0][1]==cards[1][1]==cards[2][1]==cards[3][1]==cards[4][1]) and (cards[4][0]-9==cards[0][0]+3==cards[1][0]+2==cards[2][0]+1==cards[3][0]):
return 1
return 0
def is_qua(cards):#Verifica se 'cards(5)'(ordenado) é uma quadra
if (cards[0][0]==cards[1][0]==cards[2][0]==cards[3][0]) :
return 1
if (cards[1][0]==cards[2][0]==cards[3][0]==cards[4][0]) :
return 1
return 0
def is_ful(cards):#Verifica se 'cards(5)'(ordenado) é um full house
if (cards[0][0]==cards[1][0]==cards[2][0] and cards[3][0]==cards[4][0]) :
return 1
if (cards[0][0]==cards[1][0] and cards[2][0]==cards[3][0]==cards[4][0]) :
return 1
return 0
def is_seq(cards):#Verifica se 'cards(5)'(ordenado) é uma sequencia (admite-se que não é um jogo maior que uma sequencia)
if cards[0][0]+4==cards[1][0]+3==cards[2][0]+2==cards[3][0]+1==cards[4][0]:
return 1
if (cards[4][0]-9==cards[0][0]+3==cards[1][0]+2==cards[2][0]+1==cards[3][0]):
return 1
return 0
def is_flu(cards):#Verifica se 'cards(5)'(ordenado) é um flush (admite-se que não é um jogo maior que um flush)
if cards[0][1]==cards[1][1]==cards[2][1]==cards[3][1]==cards[4][1]:
return 1
return 0
def is_tri(cards):#Verifica se 'cards(5)'(ordenado) é uma trinca (admite-se que não é um jogo maior que uma trinca)
if cards[0][0]==cards[1][0]==cards[2][0]:
return 1
if cards[1][0]==cards[2][0]==cards[3][0]:
return 1
if cards[2][0]==cards[3][0]==cards[4][0]:
return 1
return 0
def is_twp(cards):#Verifica se 'cards(5)'(ordenado) são dois pares (admite-se que não é um jogo maior que dois pares)
if cards[0][0]==cards[1][0] and cards[2][0]==cards[3][0]:
return 1
if cards[0][0]==cards[1][0] and cards[4][0]==cards[3][0]:
return 1
if cards[2][0]==cards[1][0] and cards[4][0]==cards[3][0]:
return 1
return 0
def is_par(cards):#Verifica se 'cards(5)'(ordenado) é um par (admite-se que não é um jogo maior que um par)
for i in cards[:]:
for j in cards[cards.index(i)+1:]:
if i[0]==j[0]:
return 1
return 0
def is_nul(cards):#Verifica se 'cards(5)'(ordenado) é nada (admite-se que não é um jogo maior que nada, portanto esta função é quase inútil, resquiço de um rascunho anterior)
return 1
def jogo(mao,mesa):#Determina qual é o melhor jogo possível combinando-se a 'mao' e a 'mesa', encontra também o high e kicker
jogos=["nada","par","dois pares","trinca","seq","flush","full","quadra","s_flush"]#Isso pode ser retirado e talvez melhore a perfomance
maior=-1
cards=[-1,-1,-1,-1,-1]
srted=[-1,-1,-1,-1,-1] #Senhor Ted
hi=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1]]
tudo=mao+mesa
for cards[0] in tudo[:]:
for cards[1] in tudo[tudo.index(cards[0])+1:]:
for cards[2] in tudo[tudo.index(cards[1])+1:]:
for cards[3] in tudo[tudo.index(cards[2])+1:]:
for cards[4] in tudo[tudo.index(cards[3])+1:]:
srted=sorted(cards)
if maior<=jogos.index("s_flush"):#remover esta linha (vai dar trabalho)
if is_stflu(srted)==1:
if srted[3][0]==5 and srted[4][0]==14:
srted=[srted[4]]+srted[0:4]
if maior==jogos.index("s_flush"):
if hi[4][0]<srted[4][0]:
hi=srted[:]
else:
hi=srted[:]
maior = jogos.index("s_flush")
if maior<=jogos.index("quadra"):
if is_qua(srted)==1:
if maior==jogos.index("quadra"):
if srted[0][0]==srted[1][0]:
if hi[4][0]<srted[0][0]:
hi=[srted[4]]+srted[0:4]
elif hi[4][0]==srted[0][0]:
if hi[0][0]<srted[4][0]:
hi=[srted[4]]+srted[0:4]
elif srted[3][0]==srted[4][0]:
if hi[4][0]<srted[4][0]:
hi=srted[:]
elif hi[4][0]==srted[4][0]:
if hi[0][0]<srted[0][0]:
hi=srted[:]
else:
if srted[0][0]==srted[1][0]:
hi=[srted[4]]+srted[0:4]
elif srted[3][0]==srted[4][0]:
hi=srted[:]
maior = jogos.index("quadra")
if maior<=jogos.index("full"):
if is_ful(srted)==1:
if maior == jogos.index("full"):
if srted[0][0]==srted[1][0]==srted[2][0]:
if hi[4][0]<srted[0][0]:
hi=srted[3:5]+srted[0:3]
elif hi[4][0]==srted[0][0]:
if hi[0][0]<srted[4][0]:
hi=srted[3:5]+srted[0:3]
elif srted[4][0]==srted[3][0]==srted[2][0]:
if hi[4][0]<srted[4][0]:
hi=srted[:]
elif hi[4][0]==srted[4][0]:
if hi[0][0]<srted[0][0]:
hi=srted[:]
else:
if srted[0][0]==srted[1][0]==srted[2][0]:
hi=srted[3:5]+srted[0:3]
if srted[4][0]==srted[3][0]==srted[2][0]:
hi=srted[:]
maior = jogos.index("full")
if maior<=jogos.index("flush"):
if is_flu(srted)==1:
if maior==jogos.index("flush"):
if hi[4][0]<srted[4][0]:
hi=srted[:]
elif hi[3][0]<srted[3][0]:
hi=srted[:]
elif hi[2][0]<srted[2][0]:
hi=srted[:]
elif hi[1][0]<srted[1][0]:
hi=srted[:]
elif hi[0][0]<srted[0][0]:
hi=srted[:]
else:
hi=srted[:]
maior = jogos.index("flush")
if maior<=jogos.index("seq"):
if is_seq(srted)==1:
if srted[3][0]==5 and srted[4][0]==14:
srted=[srted[4]]+srted[0:4]
if maior==jogos.index("seq"):
if hi[4][0]<srted[4][0]:
hi=srted[:]
else:
hi=srted[:]
maior = jogos.index("seq")
if maior<=jogos.index("trinca"):
if is_tri(srted)==1:
if maior == jogos.index("trinca"):
if srted[0][0]==srted[1][0]==srted[2][0]:
if hi[4][0]<srted[0][0]:
hi=srted[3:5]+srted[0:3]
elif hi[4][0]==srted[0][0]:
if hi[1]<srted[4]:
hi=srted[3:5]+srted[0:3]
elif hi[1]==srted[4]:
if hi[0]<srted[3]:
hi=srted[3:5]+srted[0:3]
elif srted[3][0]==srted[1][0]==srted[2][0]:
if hi[4][0]<srted[1][0]:
hi=[srted[0],srted[4]]+srted[1:4]
elif hi[4][0]==srted[1][0]:
if hi[1]<srted[4]:
hi=[srted[0],srted[4]]+srted[1:4]
elif hi[1]==srted[4]:
if hi[0]<srted[0]:
hi=[srted[0],srted[4]]+srted[1:4]
elif srted[3][0]==srted[4][0]==srted[2][0]:
if hi[4][0]<srted[4][0]:
hi=[srted[0],srted[1]]+srted[2:5]
elif hi[4][0]==srted[4][0]:
if hi[1]<srted[2]:
hi=[srted[0],srted[1]]+srted[2:5]
elif hi[1]==srted[2]:
if hi[0]<srted[0]:
hi=[srted[0],srted[1]]+srted[2:5]
else:
if srted[0][0]==srted[1][0]==srted[2][0]:
hi=srted[3:5]+srted[0:3]
elif srted[3][0]==srted[1][0]==srted[2][0]:
hi=[srted[0],srted[4]]+srted[1:4]
elif srted[3][0]==srted[4][0]==srted[2][0]:
hi=[srted[0],srted[1]]+srted[2:5]
maior = jogos.index("trinca")
if maior<=jogos.index("dois pares"):
if is_twp(srted)==1:
if maior==jogos.index("dois pares"):
if srted[0][0]==srted[1][0] and srted[2][0]==srted[3][0]:
if srted[0][0]>srted[2][0]:
if srted[0][0]>hi[4][0]:
hi=[srted[4]]+srted[2:4]+srted[0:2]
elif srted[0][0]==hi[4][0]:
if srted[2][0]>hi[2][0]:
hi=[srted[4]]+srted[2:4]+srted[0:2]
elif srted[2][0]==hi[2][0]:
if srted[4][0]>hi[0][0]:
hi=[srted[4]]+srted[2:4]+srted[0:2]
else:
if srted[2][0]>hi[4][0]:
hi=[srted[4]]+srted[0:2]+srted[2:4]
elif srted[2][0]==hi[4][0]:
if srted[0][0]>hi[2][0]:
hi=[srted[4]]+srted[0:2]+srted[2:4]
elif srted[0][0]==hi[2][0]:
if srted[4][0]>hi[0][0]:
hi=[srted[4]]+srted[0:2]+srted[2:4]
elif srted[0][0]==srted[1][0] and srted[4][0]==srted[3][0]:
if srted[0][0]>srted[3][0]:
if srted[0][0]>hi[4][0]:
hi=[srted[2]]+srted[3:5]+srted[0:2]
elif srted[0][0]==hi[4][0]:
if srted[3][0]>hi[2][0]:
hi=[srted[2]]+srted[3:5]+srted[0:2]
elif srted[3][0]==hi[2][0]:
if srted[2][0]>hi[0][0]:
hi=[srted[2]]+srted[3:5]+srted[0:2]
else:
if srted[3][0]>hi[4][0]:
hi=[srted[2]]+srted[0:2]+srted[3:5]
elif srted[3][0]==hi[4][0]:
if srted[0][0]>hi[2][0]:
hi=[srted[2]]+srted[0:2]+srted[3:5]
elif srted[0][0]==hi[2][0]:
if srted[2][0]>hi[0][0]:
hi=[srted[2]]+srted[0:2]+srted[3:5]
elif srted[2][0]==srted[1][0] and srted[4][0]==srted[3][0]:
if srted[1][0]>srted[3][0]:
if srted[1][0]>hi[4][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[1][0]==hi[4][0]:
if srted[3][0]>hi[2][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[3][0]==hi[2][0]:
if srted[0][0]>hi[0][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
else:
if srted[3][0]>hi[4][0]:
hi=[srted[0]]+srted[1:3]+srted[3:5]
elif srted[3][0]==hi[4][0]:
if srted[1][0]>hi[2][0]:
hi=[srted[0]]+srted[1:3]+srted[3:5]
elif srted[1][0]==hi[2][0]:
if srted[0][0]>hi[0][0]:
hi=[srted[0]]+srted[1:3]+srted[3:5]
else:
if srted[0][0]==srted[1][0] and srted[2][0]==srted[3][0]:
if srted[0][0]>srted[2][0]:
hi=[srted[4]]+srted[2:4]+srted[0:2]
else:
hi=[srted[4]]+srted[0:2]+srted[2:4]
elif srted[0][0]==srted[1][0] and srted[4][0]==srted[3][0]:
if srted[0][0]>srted[3][0]:
hi=[srted[2]]+srted[3:5]+srted[0:2]
else:
hi=[srted[2]]+srted[0:2]+srted[3:5]
elif srted[2][0]==srted[1][0] and srted[4][0]==srted[3][0]:
if srted[1][0]>srted[3][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
else:
hi=srted[:]
maior = jogos.index("dois pares")
if maior<=jogos.index("par"):
if is_par(cards)==1:
if maior==jogos.index("par"):
if srted[4][0]==srted[3][0]:
if srted[4][0]>hi[4][0]:
hi=srted[:]
elif srted[4][0]==hi[4][0]:
if srted[2][0]>hi[2][0]:
hi=srted[:]
elif srted[2][0]==hi[2][0]:
if srted[1][0]>hi[1][0]:
hi=srted[:]
elif srted[1][0]==hi[1][0]:
if srted[0][0]>hi[0][0]:
hi=srted[:]
elif srted[3][0]==srted[2][0]:
if srted[3][0]>hi[4][0]:
hi=srted[0:2]+[srted[4]]+srted[2:4]
elif srted[3][0]==hi[4][0]:
if srted[4][0]>hi[2][0]:
hi=srted[0:2]+[srted[4]]+srted[2:4]
elif srted[4][0]==hi[2][0]:
if srted[1][0]>hi[1][0]:
hi=srted[0:2]+[srted[4]]+srted[2:4]
elif srted[1][0]==hi[1][0]:
if srted[0][0]>hi[0][0]:
hi=srted[0:2]+[srted[4]]+srted[2:4]
elif srted[2][0]==srted[1][0]:
if srted[2][0]>hi[4][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[2][0]==hi[4][0]:
if srted[4][0]>hi[2][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[4][0]==hi[2][0]:
if srted[3][0]>hi[1][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[3][0]==hi[1][0]:
if srted[0][0]>hi[0][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[1][0]==srted[0][0]:
if srted[1][0]>hi[4][0]:
hi=srted[2:5]+srted[0:2]
elif srted[1][0]==hi[4][0]:
if srted[4][0]>hi[2][0]:
hi=srted[2:5]+srted[0:2]
elif srted[4][0]==hi[2][0]:
if srted[3][0]>hi[1][0]:
hi=srted[2:5]+srted[0:2]
elif srted[3][0]==hi[1][0]:
if srted[2][0]>hi[0][0]:
hi=srted[2:5]+srted[0:2]
else:
if srted[4][0]==srted[3][0]:
hi=srted[:]
elif srted[3][0]==srted[2][0]:
hi=srted[0:2]+[srted[4]]+srted[2:4]
elif srted[2][0]==srted[1][0]:
hi=[srted[0]]+srted[3:5]+srted[1:3]
elif srted[1][0]==srted[0][0]:
hi=srted[2:5]+srted[0:2]
maior = jogos.index("par")
if maior<=jogos.index("nada"):
if is_nul(cards)==1:
if srted[4][0]>hi[4][0]:
hi=srted[:]
elif srted[4][0]==hi[4][0]:
if srted[3][0]>hi[3][0]:
hi=srted[:]
elif srted[3][0]==hi[3][0]:
if srted[2][0]>hi[2][0]:
hi=srted[:]
elif srted[2][0]==hi[2][0]:
if srted[1][0]>hi[1][0]:
hi=srted[:]
elif srted[1][0]==hi[1][0]:
if srted[0][0]>hi[0][0]:
hi=srted[:]
maior = jogos.index("nada")
return [maior]+hi
def print_cd(cards,legenda="",esp="",passo=1):#função mal-feita que imprime cartas
d = {-1:"? ",0:"Ouros", 1:"Paus ", 2:"Copas", 3:"Espad"}
cartas = {-1:"?",2:"2", 3:"3", 4:"4", 5:"5", 6:"6", 7:"7", 8:"8", 9:"9", 10:"10", 11:"J", 12:"Q", 13:"K", 14:"A"}
print
if legenda!="":
for i in range(len(cards)):
print "%8.15s"%str(legenda[i]),
if (i+1)%passo==0:
print esp,
print
for i in range(len(cards)):
print " ,_____,",
if (i+1)%passo==0:
print esp,
print
for i in range(len(cards)):
print " |"+d[cards[i][1]]+"|",
if (i+1)%passo==0:
print esp,
print
for i in range(len(cards)):
print " | |",
if (i+1)%passo==0:
print esp,
print
for i in range(len(cards)):
print " |%3.3s"% cartas[cards[i][0]]," |",
if (i+1)%passo==0:
print esp,
print
for i in range(len(cards)):
print " | |",
if (i+1)%passo==0:
print esp,
print
for i in range(len(cards)):
print " |_____|",
if (i+1)%passo==0:
print esp,
print
denovo=1
while denovo==1:
dec= range(2,15,1)
dec = dec + dec + dec +dec
l = len(dec)
i=0
while i < l:
dec[i]=[dec[i],i/13]
i+=1
#até aqui define o baralho: J=11 Q=12 K=13 As=14, naipes arbitrários
conta=0
mao=[[-1,-1],[-1,-1]] #cartas na mão do jogador (deverá ser input)
pl=[[-1,-1],[-1,-1]] #cartas na mão do adversário (pode ou não ser input)
tb=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1]] #cartas da mesa (pode ou não ser input)
ad_g=[] #jogo do adversário
pl_g=[] #jogo do jogador
respR=-1 #Já foi o river?
respT=-1 #Já foi o turn?
respF=-1 #já foi o Flop?
respA=-1 #Sabe as cartas do adversário?
poss=0 #total de possiblidades
boa=0 #possibilidades vencedoras
ruim=0 #possibilidades perdedoras
tie=0 #possibilidades empatadoras
ad_poss=[0,0,0,0,0,0,0,0,0] #Possibilidades de jogo do adversário
pl_poss=[0,0,0,0,0,0,0,0,0] #Possibilidades de jogo do jogador
jogos=["Nada","Um Par","Dois Pares","Trinca","Seqüência","Flush","Full House","Quadra","Straigh Flush"]
print "LEGENDA:"
print "números -> eles mesmos"
print "J -> 11\nQ -> 12\nK -> 13\nA -> 14"
print "Ouros -> 0\nPaus -> 1\nCopas -> 2\nEspadas -> 3"
print
print "Quais são suas cartas?"
mao[0]=drwcd(dec," 1ª ")
mao[1]=drwcd(dec," 2ª ")
print
print "Sua mão é: \"" + showcd(mao[0]) + "\" e \"" + showcd(mao[1]) + "\""
print
respA=perg("Você sabe as cartas do adversário? 1-sim 0-nao",range(2))
if respA==1:
print "Seu safado!"
pl[0]=drwcd(dec," 1ª ")
pl[1]=drwcd(dec," 2ª ")
print
print "A mão dele é: \"" + showcd(pl[0]) + "\" e \"" + showcd(pl[1]) + "\""
print
respF=perg("Já saiu o flop? 1-sim 0-nao",range(2))
if respF==1:
tb[2]=drwcd(dec," 1ª ")
tb[3]=drwcd(dec," 2ª ")
tb[4]=drwcd(dec," 3ª ")
print
print "O flop é: \"" + showcd(tb[2]) + "\", \"" + showcd(tb[3]) + "\" e \"" + showcd(tb[4]) + "\""
print
respT = perg("Já saiu o turn? 1-sim 0-nao",range(2))
if respT==1:
tb[1]=drwcd(dec)
print
print "O turn é: \"" + showcd(tb[1]) + "\""
print
respR = perg("Já saiu o river? 1-sim 0-nao",range(2))
if respR==1:
tb[0]=drwcd(dec)
print
print "O turn é: \"" + showcd(tb[0]) + "\""
print
print "Situação:"
tb.reverse()
print_cd(tb[:],["","Flop ","","Turn ","River "])
print_cd(mao+pl,[" Sua mão",""," Mao dele",""],"\t ",2)
print
print "Aguarde..."
tb.reverse()
dek = dec[:]
if respT==-1:respT=0
if respR==-1:respR=0
#Faz a combinação e arranjo necessários
for k in dec[:]:
if respA==0: pl[0]=k
dek=dec[:]
for l in dek[dek.index(k)+1:]:
dek=dec[:]
if respA==0:
pl[1]=l
dek.remove(l)
dek.remove(k)
for m in dek[:]:
if respR==0: tb[0]=m
if respT==0:
indice=dek.index(m)+1
else:
indice=0
for n in dek[indice:]:
if respT==0: tb[1]=n
if respF==0:
indice=dek.index(n)+1
else:
indice=0
for p in dek[indice:]:
if respF==0:
tb[2]=p
indice=dek.index(p)+1
else:
indice=0
for q in dek[indice:]:
if respF==0:
tb[3]=q
indice=dek.index(q)+1
else:
indice=0
for r in dek[indice:]:
if respF==0: tb[4]=r
ad_g=jogo(pl,tb)
pl_g=jogo(mao,tb)
pl_poss[pl_g[0]]+=1
ad_poss[ad_g[0]]+=1
if pl_g[0]>ad_g[0]:
boa+=1
elif pl_g[0]<ad_g[0]:
ruim+=1
else:
i=5
while i >= 1:
if pl_g[i][0]>ad_g[i][0]:
boa+=1
i=-1
elif pl_g[i][0]<ad_g[i][0]:
ruim+=1
i=-1
i-=1
if i == 0 : tie+=1
conta+=1
if respF!=0: break
if respF!=0: break
if respF!=0: break
if respT!=0: break
if respR!=0: break
if respA!=0: break
if respA!=0: break
print
print "Possibilidades do Adversário:"
for i in range(9):
print "\t%13.13s: %4.2f%%" % (jogos[i],ad_poss[i]/float(boa+ ruim+ tie)*100),
if (i+1)%3==0:print
print
print "Possibilidades do Jogador:"
for i in range(9):
print "\t%13.13s: %3.2f%%" % (jogos[i],pl_poss[i]/float(boa+ ruim+ tie)*100),
if (i+1)%3==0:print
print
print "Chances de vitória: %.2f%%" % (boa/float(boa+ ruim+ tie)*100)
print "Chances de derrota: %.2f%%" % (ruim/float(boa+ ruim+ tie)*100)
print "Chances de empate: %.2f%%" % (tie/float(boa+ ruim+ tie)*100)
print
denovo=perg("De novo? 1-Sim 0-Nao",range(2))
Unescape de caracteres especiais ISO-8859-1
Modificação do Ubuntu Tweak para Debian
Veja a versão das principais distrubuições.
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Novos apps de produtividade, avanços em IA e distros em ebulição agitam o universo Linux
Como instalar o repositório do DBeaver no Ubuntu
Como instalar o Plex Media Server no Ubuntu
Digitando underscore com "shift" + "barra de espaços"
Como ativar a lixeira e recuperar aquivos deletados em um servidor Linux
Como mudar o nome de dispositivos Bluetooth via linha de comando
O programa assinador digital (0)
dpkg: erro: gatilho de arquivo duplicado chamado pelo arquivo de nome (6)
Instalação não está resolvendo as dependencias (2)
Captação de áudio no zorin linux começa a diminuir com o tempo (5)









