Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #Autorid: Karl Kaspar Haavel, Triin Peitel, Roman Sytchyov, Silvia Tänav
  2.  
  3. def replace_char(y1,y2,y3,y4,y5): #Asendab "Halva tähe" numbriga.
  4. mast = {
  5. "♥" : 1,
  6. "♦" : 2,
  7. "♣" : 3,
  8. "♠" : 4}
  9. return mast[y1], mast[y2], mast[y3], mast[y4], mast[y5]
  10.  
  11. def bad_remov(k1): #Eemaldab sõnest "halvad tähed." (Bad characters).
  12. k1 = k1.strip('♥')
  13. k1 = k1.strip("♦")
  14. k1 = k1.strip("♣")
  15. k1 = k1.strip("♠")
  16. return k1
  17.  
  18. def replace_char2(x1):
  19. pilt = {
  20. "2" : 2,
  21. "3" : 3,
  22. "4" : 4,
  23. "5" : 5,
  24. "6" : 6,
  25. "7" : 7,
  26. "8" : 8,
  27. "9" : 9,
  28. "10": 10,
  29. "J" : 11,
  30. "Q" : 12,
  31. "K" : 13,
  32. "A" : 14}
  33. return pilt[x1]
  34.  
  35.  
  36. def käsi(k1, k2, k3, k4, k5):
  37.  
  38. x1 = k1[:-1]
  39. y1 = k1[-1]
  40. x2 = k2[:-1]
  41. y2 = k2[-1]
  42. x3 = k3[:-1]
  43. y3 = k3[-1]
  44. x4 = k4[:-1]
  45. y4 = k4[-1]
  46. x5 = k5[:-1]
  47. y5 = k5[-1]
  48.  
  49.  
  50. replace_char(y1,y2,y3,y4,y5)
  51.  
  52. # Kuninglik mastirida
  53. if x1 == 10 and x1 < x2 < x3 < x4 < x5 and y1 == y2 == y3 == y4 == y5:
  54. return "Kuninglik mastirida"
  55. # Mastirida
  56. elif (x1 +1) == x2 and (x2 +1) == x3 and (x3 +1) == x4 and (x4 +1) == x5 and y1 == y2 == y3 == y4 == y5:
  57. return "Mastirida"
  58. # Nelik
  59. elif x1 == x2 == x3 == x4 or x2 == x3 == x4 == x5:
  60. return "Nelik"
  61. # Maja
  62. elif (x1 == x2 == x3 and x4 == x5) or (x1 == x2 and x3 == x4 == x5):
  63. return "Maja"
  64. # Mast
  65. elif y1 == y2 == y3 == y4 == y5:
  66. return "Mast"
  67. # Rida
  68. elif (x1 +1) == x2 and (x2 +1) == x3 and (x3 +1) == x4 and (x4 +1) == x5:
  69. return "Rida"
  70. # Kolmik
  71. elif x1 == x2 == x3 or x2 == x3 == x4 or x3 == x4 == x5:
  72. return "Kolmik"
  73. # Kaks paari
  74. 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):
  75. return "Kaks paari"
  76. # Paar
  77. 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:
  78. return "Üks paar"
  79. # Kõrge kaart
  80. else:
  81. return "Kõrge kaart"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement