Advertisement
HelloWorld_1000000

Untitled

Dec 3rd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. import random
  2. print(" Welcome to the squirmy game of Snakes and Ladders! Your objective is to divide and conquer, A.K.A win the game! Your greatest skills are needed to defeat Computer, be quick and agile. Now go forth and play the game!")
  3. Start = 1
  4. End = 25
  5.  
  6. PlayerNum = random.randint(1, 6)
  7. ComputerNum = random.randint(1, 6)
  8. Roll0 = PlayerNum
  9. Roll1 = ComputerNum
  10. Tries = 10
  11.  
  12.  
  13. while Roll0 and Roll1 != End:
  14. while Tries <= 5:
  15. PlayerNum = random.randint(1, 6)
  16. ComputerNum = random.randint(1, 6)
  17. print("You rolled a",Roll0)
  18. print("Computer rolled a",Roll1)
  19. Roll0 = (Roll0+Start)
  20. Roll1 = (Roll1+Start)
  21. Tries += 1
  22. if Roll0 == 6:
  23. print("You rolled six and roll again.")
  24. Roll0 = (Roll0+PlayerNum)
  25. Tries += 1
  26. print("You're now on square",Roll0)
  27.  
  28. elif Roll1 == 6:
  29. print("Computer rolled six and rolls again.")
  30. Tries += 1
  31. Roll1 = (Roll1+ComputerNum)
  32. print("Computer is now on square",Roll1)
  33. else:
  34. print("You're on square",Roll0)
  35. print("Computer is on square",Roll1)
  36. if Roll0 == (3, 4, 8, 13, 17, 18):
  37. print("You rolled on the snake! You stay put until Computer goes another turn.")
  38. if Roll1 == (3, 4, 8, 13, 17, 18):
  39. print("Computer rolled on the snake! You you get to go another turn!")
  40. if Roll0 == 9:
  41. print("You rolled on snake head and go back to square 4!")
  42. Roll0 = 4
  43. elif Roll1 == 9:
  44. print("Computer rolled on snake head and goes back to square 4!")
  45. Roll1 = 4
  46. if Roll0 == 24:
  47. print("You rolled on snake head and go back to square 13!")
  48. Roll0 = 13
  49. elif Roll1 == 24:
  50. print("Computer rolled on snake head and goes back to square 13!")
  51. Roll1 = 13
  52. if Roll0 == 5 or 6:
  53. Roll0 = 15
  54. print("You went up the Ladder to 15! Way to go!")
  55. elif Roll1 == 5 or 6:
  56. Roll1 = 15
  57. print("Computer climbed up the Ladder to 15! You better catch up to Computer soon!")
  58. if Roll0 == (11, 12, 19, 20):
  59. Roll0 = 21
  60. print("You went up the Ladder to 21! You're almost there just keep going!")
  61. elif Roll1 == (11, 12, 19, 20):
  62. Roll1 = 21
  63. print("Computer climbed the Ladder to 21! Hurry up before Computer wins the game!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement