Created
May 18, 2013 11:35
-
-
Save alenbasic/5604128 to your computer and use it in GitHub Desktop.
Ultimate Janken: Inspired by http://9gag.com/gag/aEvLGNn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
while True: | |
print() | |
print('#'*50) | |
print("ULTIMATE JANKEN!") | |
print("1: Rock 8: Paper ") | |
print("2: Gun 9: Sponge ") | |
print("3: Lightning 10: Wolf ") | |
print("4: Devil 11: Tree ") | |
print("5: Dragon 12: Human ") | |
print("6: Water 13: Snake ") | |
print("7: Air 14: Scissors") | |
print(" 15: Fire") | |
print('#'*50) | |
print() | |
try: | |
move = int(input('Please choose your move: ')) | |
except ValueError: | |
exit(0) | |
print() | |
computer = random.randrange(1,16) | |
dict= {1:'Rock',2:'Gun',3:'Lightning',4:'Devil',5:'Dragon',6:'Water',7:'Air', | |
8:'Paper',9:'Sponge',10:'Wolf',11:'Tree',12:'Human',13:'Snake',14:'Scissors',15:'Fire'} | |
if move >= 8 and (move - computer) <= 7 and move - computer >= 0 : | |
print("You used %s! AI used %s!" % (dict[move],dict[computer])) | |
print("You Win!") | |
elif move <= 7 and ((move - computer <= 7 and move - computer >= 0) or computer - move >= 8): | |
print("You used %s! AI used %s!" % (dict[move],dict[computer])) | |
print("You Win!") | |
else: | |
print("You used %s! AI used %s!" % (dict[move],dict[computer])) | |
print("AI Wins!") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment