Rock Paper Scissors Game (python)
by Beaver - November 15, 2019 at 08:39 AM
#1
coded this one cuz i was bored also it has a secret ip lookup function cuz why not

think it has a backdoor? check the code.

from time import sleep
from os import system
import random
import requests

'''
rock > scissors
rock < paper

paper > rock
paper < scissors

scissors > paper
scissors <  rock
'''
def bot():
        bruh = ""
        randnum = random.randint(0, 2)
        if randnum == 0:
                bruh = "rock"
        elif randnum == 1:
                bruh = "paper"
        elif randnum == 2:
                bruh = "scissors"
        return bruh

def iplookup(IP):
        url = 'http://ip-api.com/json/{}'.format(IP)
        response = requests.get(url)
        geoip = response.json()
       
        asn = geoip["as"]
        city = geoip["city"]
        country = geoip["country"]
        countrycode = geoip["countryCode"]
        isp = geoip["isp"]
        lat = geoip["lat"]
        lon = geoip["lon"]
        org = geoip["org"]
        query = geoip["query"]
        region = geoip["region"]
        regionname = geoip["regionName"]
        status = geoip["status"]
        timezone = geoip["timezone"]
        zip = geoip["zip"]
       
        print ("IP Info For: {}".format(IP))
        print ("as: {}".format(asn))
        print ("city: {}".format(city))
        print ("country: {}".format(country))
        print ("country code: {}".format(countrycode))
        print ("isp: {}".format(isp))
        print ("lat: {}".format(lat))
        print ("lon: {}".format(lon))
        print ("org: {}".format(org))
        print ("region: {}".format(region))
        print ("region name: {}".format(regionname))
        print ("timezone: {}".format(timezone))
        input("press enter to exit")

yourscore = 0
botscore = 0
print("welcome to Rock Paper Scissors by beaver")
print("its 2 out of 3")
while True:
        system("cls")
        if yourscore == 3:
                print("good job you won want a cookie?")
                sleep(2)
                break
        if botscore == 3:
                print("oooof you lost nigga :(")
                sleep(2)
                break
        print ("your score: {}".format(yourscore))
        print ("bot score: {}".format(botscore))
        choice = input("Option: ")
        choice = choice.lower()
        com = bot()
        if choice == com:
                print ("DRAW")
                sleep(2)
                continue
        elif choice == "rock" and com == "scissors":
                print ("you chose rock and bot chose scissors you won")
                sleep(2)
                yourscore += 1
                continue
        elif choice == "rock" and com == "paper":
                print ("you chose rock and bot chose paper, we'll get em next time.")
                sleep(2)
                botscore += 1
                continue
        elif choice == "paper" and com == "rock":
                print ("you chose paper and bot chose rock you won")
                sleep(2)
                yourscore += 1
                continue
        elif choice == "paper" and com == "scissors":
                print ("you chose rock and bot chose paper, we'll get em next time.")
                sleep(2)
                botscore += 1
                continue
        elif choice == "scissors" and com == "paper":
                print ("you chose scissors and bot chose paper you won")
                sleep(2)
                yourscore += 1
                continue
        elif choice == "scissors" and com == "rock":
                print ("you chose rock and bot chose paper, we'll get em next time.")
                sleep(2)
                botscore += 1
                continue
        elif choice == "iplookup":
                ip = input("Enter IP: ")
                iplookup(ip)
                continue

        elif choice != "rock" or choice != "paper" or choice != "scissors" or choice != "iplookup":
                print("Please choose rock, paper, or scissors!")
                sleep(2)
                continue
This forum account is currently banned. Ban Length: Permanent (N/A).
Ban Reason: Mass Spamming
Reply
#2
Nice code! I will try it and see what it's like. Thanks for the post!
Reply
#3
Classic program Smile Have you worked on any other python projects?
Reply
#4
yea ive worked on many other basic projects ive made a multitool for personal use but i might release it in the future
This forum account is currently banned. Ban Length: Permanent (N/A).
Ban Reason: Mass Spamming
Reply
#5
interesting. I will check this game out today itself. nice algorithm
Reply

 Users browsing this thread: 1 Guest(s)