Advertisement
pacho_the_python

Untitled

Nov 17th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 KB | None | 0 0
  1. import random
  2.  
  3. difficulty = input("Choose between Easy, Hard, Inhuman or Custom: ")
  4.  
  5. n = 0
  6. k = 0
  7. if difficulty == "Easy":
  8.     n = 10
  9. elif difficulty == "Hard":
  10.     n = 25
  11. elif difficulty == "Inhuman":
  12.     n = 50
  13. elif difficulty == "Custom":
  14.     n = int(input("Enter first number: "))
  15.     k = int(input("Enter second number "))
  16. bomb = "*"
  17. empty = "-"
  18. combinations = bomb + empty
  19. length = n
  20. board = ""
  21. for i in range(n):
  22.     if difficulty == "Easy":
  23.         board = " ".join(random.choices(combinations, weights=[15, 50], k=length))
  24.     elif difficulty == "Hard":
  25.         board = " ".join(random.choices(combinations, weights=[25, 50], k=length))
  26.     elif difficulty == "Inhuman":
  27.         board = " ".join(random.choices(combinations, weights=[50, 50], k=length))
  28.     elif difficulty == "Custom":
  29.         board = " ".join(random.choices(combinations, weights=[35, 50], k=k))
  30.  
  31.  
  32. # player_board
  33. if difficulty == "Easy" or difficulty == "Hard" or difficulty == "Inhuman":
  34.     for i in range(n):
  35.         for j in range(n):
  36.             print("^ ", end="")
  37.         print()
  38. elif difficulty == "Custom":
  39.     for i in range(n):
  40.         for j in range(k):
  41.             print("^ ", end="")
  42.         print()
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement