Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Autorid: Karl Kaspar Haavel, Triin Peitel, Roman Sytchyov, Silvia Tänav
- def replace_char(y1,y2,y3,y4,y5): #Asendab "Halva tähe" numbriga.
- mast = {
- "♥" : 1,
- "♦" : 2,
- "♣" : 3,
- "♠" : 4}
- return mast[y1], mast[y2], mast[y3], mast[y4], mast[y5]
- def bad_remov(k1): #Eemaldab sõnest "halvad tähed." (Bad characters).
- k1 = k1.strip('♥')
- k1 = k1.strip("♦")
- k1 = k1.strip("♣")
- k1 = k1.strip("♠")
- return k1
- def replace_char2(x1):
- pilt = {
- "2" : 2,
- "3" : 3,
- "4" : 4,
- "5" : 5,
- "6" : 6,
- "7" : 7,
- "8" : 8,
- "9" : 9,
- "10": 10,
- "J" : 11,
- "Q" : 12,
- "K" : 13,
- "A" : 14}
- return pilt[x1]
- def käsi(k1, k2, k3, k4, k5):
- x1 = k1[:-1]
- y1 = k1[-1]
- x2 = k2[:-1]
- y2 = k2[-1]
- x3 = k3[:-1]
- y3 = k3[-1]
- x4 = k4[:-1]
- y4 = k4[-1]
- x5 = k5[:-1]
- y5 = k5[-1]
- replace_char(y1,y2,y3,y4,y5)
- # Kuninglik mastirida
- if x1 == 10 and x1 < x2 < x3 < x4 < x5 and y1 == y2 == y3 == y4 == y5:
- return "Kuninglik mastirida"
- # Mastirida
- elif (x1 +1) == x2 and (x2 +1) == x3 and (x3 +1) == x4 and (x4 +1) == x5 and y1 == y2 == y3 == y4 == y5:
- return "Mastirida"
- # Nelik
- elif x1 == x2 == x3 == x4 or x2 == x3 == x4 == x5:
- return "Nelik"
- # Maja
- elif (x1 == x2 == x3 and x4 == x5) or (x1 == x2 and x3 == x4 == x5):
- return "Maja"
- # Mast
- elif y1 == y2 == y3 == y4 == y5:
- return "Mast"
- # Rida
- elif (x1 +1) == x2 and (x2 +1) == x3 and (x3 +1) == x4 and (x4 +1) == x5:
- return "Rida"
- # Kolmik
- elif x1 == x2 == x3 or x2 == x3 == x4 or x3 == x4 == x5:
- return "Kolmik"
- # Kaks paari
- elif (x1 == x2 and x3 == x4) or (x1 == x3 and x2 == x4) or (x1 == x5 and x2 == x4) or (x2 == x3 and x4 == x5) or (x1 == x2 and x4 == x5):
- return "Kaks paari"
- # Paar
- elif x1 == x2 or x1 == x3 or x1 == x4 or x1 == x5 or x2 == x3 or x2 == x4 or x2 == x5 or x3 == x4 or x3 == x5 or x4 == x5:
- return "Üks paar"
- # Kõrge kaart
- else:
- return "Kõrge kaart"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement