Advertisement
otorp2

penny gae

Mar 29th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1.  
  2.  
  3. noc = int(input("How many coins do you want to play with?\n"))
  4.  
  5. print("Ok",noc,"coins it shall be. Lets lay them all down as 'tails'. The goal is to find out if we can achieve all",noc,"coins showing heads by flipping a set number of coins per turn.\n")
  6.  
  7. nof = int(input("How many coins do you want to flip per turn?\n"))
  8.  
  9. print("Ok! We have a",noc,"coin game and we will flip",nof,"coins at a time.\n")
  10. go = input("Press [Enter] and I shall tell you if all the coins can be changed to 'heads.'\n")
  11.  
  12. mod_div = noc/nof
  13. which_turn = noc - nof +1
  14. turns_left = noc - which_turn
  15.  
  16. if noc % nof == 0:
  17. print("thats easy you can do it in",int(mod_div),"flips")
  18. print("GAME OVER - PRESS THE PLAY ARROW FOR NEW GAME.\n\n\n\n\n\n\n")
  19.  
  20. elif turns_left % 2 == 0:
  21. print("The last element will change to heads on turn number:", which_turn)
  22. print("")
  23. print(noc,"[coin game]-","[last coin changes to heads on turn]", which_turn, "=", turns_left,"turn(s) left\n")
  24.  
  25. print("Yes! On flip number", noc,"The coins will turn all heads.\n")
  26. print("GAME OVER - PRESS THE PLAY ARROW FOR NEW GAME.\n\n\n\n\n\n\n")
  27. else:
  28. #if turn_left % 2 != 0:
  29. print("The last element will turn to heads on turn number :", which_turn)
  30. print("")
  31. print(noc,"[coin game]-","[last coin changes to heads on turn]", which_turn, "= ", turns_left,"turn(s) left\n")
  32.  
  33. print(turns_left, "is odd..sorry you can't\n")
  34. print("GAME OVER - PRESS THE PLAY ARROW FOR NEW GAME.\n\n\n\n\n\n\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement