Advertisement
here2share

# deductivelogicgame.py

Jul 5th, 2017
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. # deductivelogicgame.py
  2.  
  3. from random import *
  4. from time import *
  5.  
  6. sss = [chr(z+64) for z in range(1,27)]
  7. qqq = "Select a letter from the following -> "
  8. pts = [0, 0.25, 1, 2, 5]
  9.  
  10. def action():
  11.     seed(123123)
  12.     shuffle(sss)
  13.     seed(time())
  14.    
  15.     for score in range(1,101):
  16.         ttt = sss[:]
  17.         shuffle(ttt)
  18.         print "Round: "+str(score)
  19.         print
  20.         c=0
  21.         for z in range(1,4):
  22.             round = ttt[:5]
  23.             ttt = ttt[5:]
  24.             print "Part "+str(z)+" Out Of 3 --"
  25.             while 1:
  26.                 ans = raw_input(qqq+str(round)+" ::: ").strip().upper()
  27.                 if ans in round:
  28.                     round.sort(key=lambda x: sss.index(x))
  29.                     c+=pts[round.index(ans)]
  30.                     break
  31.                 else:
  32.                     print "That entry is invalid..."
  33.             print
  34.         if c > 7 or c > 1 + (score * 0.25):
  35.             print "You managed to score enough points to pass that round. Onto the next..."
  36.         else:
  37.             print "Unfortunately... you did not score enough points to pass that round."
  38.             print "Score: "+str(score-1)
  39.             print "\nGame Over\n\n"
  40.             return
  41.  
  42. while 1:
  43.     action()
  44.     ans = raw_input("Play Again? (Y/N): ").strip().upper()
  45.     if 'N' in ans: break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement