Last active
August 29, 2015 14:10
-
-
Save jonaslsaa/4cf0471f703f5a5d5c06 to your computer and use it in GitHub Desktop.
2 Player Guessing Game. The player nearest to random number wins. Local
This file contains hidden or 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 | |
#To do: Make it multiplayer LAN version! | |
print("\n"*50) | |
print("Welcome to guess the it!") | |
print("") | |
print("") | |
player1name=raw_input("Enter your name player 1: ") | |
player2name=raw_input("Enter your name player 2: ") | |
while True: | |
player1 = input(player1name+" Type in number your number 0 - 100: ") | |
print("\n"*50) | |
player2 = input(player2name+" Type in number your number 0 - 100: ") | |
print("\n"*50) | |
rnd = random.randint(0, 100) | |
print("Random Number is: " + str(rnd)) | |
p1r = rnd - player1 | |
p2r = rnd - player2 | |
p1r = abs(p1r) | |
p2r = abs(p2r) | |
if p1r == p2r: | |
print("It's a tie!\n") | |
elif p1r < p2r: | |
print(player1name+" Wins!\n") | |
elif p2r < p1r: | |
print(player2name+" Wins!\n") | |
print("Press Enter to play again!") | |
dummy = raw_input() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment