Advertisement
Wojtekd

Wisielec

Mar 2nd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.19 KB | None | 0 0
  1. # wisielec
  2.  
  3. import random
  4.  
  5. GRAFIKA =[
  6. """
  7. ___________
  8. ||--------
  9. ||/      
  10. ||        
  11. ||        
  12. ||      
  13. ||  
  14. ||
  15. ||
  16. """
  17. ,
  18. """
  19. ___________
  20. ||--------|
  21. ||/       |
  22. ||        |
  23. ||        
  24. ||      
  25. ||  
  26. ||
  27. ||
  28. """
  29. ,
  30. """
  31. ___________
  32. ||--------|
  33. ||/       |
  34. ||        |
  35. ||        O
  36. ||      
  37. ||        
  38. ||
  39. ||
  40. """
  41. ,
  42. """
  43. ___________
  44. ||--------|
  45. ||/       |
  46. ||        |
  47. ||        O
  48. ||       /
  49. ||        
  50. ||
  51. ||
  52. """
  53. ,
  54. """
  55. ___________
  56. ||--------|
  57. ||/       |
  58. ||        |
  59. ||        O
  60. ||       /|
  61. ||        
  62. ||
  63. ||
  64. """
  65. ,
  66. """
  67. ___________
  68. ||--------|
  69. ||/       |
  70. ||        |
  71. ||        O
  72. ||       /|\
  73. ||        
  74. ||
  75. ||
  76. """
  77. ,
  78. """
  79. ___________
  80. ||--------|
  81. ||/       |
  82. ||        |
  83. ||        O
  84. ||       /|\
  85. ||       /  
  86. ||
  87. ||
  88. """
  89. ,
  90. """
  91. ___________
  92. ||--------|
  93. ||/       |
  94. ||        |
  95. ||        O
  96. ||       /|\
  97. ||       / \
  98. ||
  99. ||
  100. """]
  101.  
  102. slowa = ["woda","ogien","powietrze","ziemia"]
  103.  
  104. while slowa:
  105.     aktualny_stan_powieszenia = 0
  106.  
  107.     choice = random.choice(slowa)
  108.     tajemnicze_slowo = '-' * len(choice)
  109.     print("wybrano słowo, ma {0} liter.".format(len(choice)))
  110.    
  111.     while aktualny_stan_powieszenia < 7:    
  112.         litera = input("podaj literkę: ")    
  113.         if litera in choice:
  114.  
  115.             nowy = ""    
  116.                    
  117.             for i in range(len(choice)):
  118.                 if choice[i] == litera:
  119.                     nowy += choice[i];
  120.                 else:
  121.                     nowy += tajemnicze_slowo[i]
  122.            
  123.             print("jest taka litera w slowie")
  124.             print(nowy)
  125.             tajemnicze_slowo = nowy
  126.  
  127.             if tajemnicze_slowo == choice:
  128.                 print("brawo, koniec gry")
  129.                 break
  130.         else:  
  131.             print("nie ma takiej litery w slowie")
  132.             aktualny_stan_powieszenia += 1
  133.             print(GRAFIKA[aktualny_stan_powieszenia])
  134.             if aktualny_stan_powieszenia > 6:
  135.                 print("przegrales.")
  136.                 break
  137.     nextgame = input("chcesz jeszcze zagrac?")
  138.     if nextgame == "nie":
  139.         break
  140.     else:
  141.         slowa.remove(choice)
  142.         continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement