Advertisement
pacho_the_python

Untitled

Nov 17th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 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.     print(board)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement