Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Coders Lounge › Rock Paper Scissors Source Code

Rock Paper Scissors Source Code

Posts 1–5 of 5 · Page 1 of 1
Poloh
Poloh
Rock Paper Scissors Source Code
#poloh
import random

userHand = input("rock, paper, or scissors")
computerHand = random.random()

if computerHand < .33:
computerHand = ("rock")
elif computerHand < .66:
computerHand = ("paper")
else:
computerHand = ("scissors")


def game(first,second):
if first == second:
print ("You chose",first)
print ("Computer chose", second)
print ("It's a tie!")
elif first == ("rock"):
if second == ("scissors"):
print ("You chose",first)
print ("Computer chose",second)
print ("You Win!")
else:
print ("You chose", first)
print ("Comuter chose", second)
print ("You lose.")
elif first == ("paper"):
if second == ("rock"):
print ("You chose",first)
print ("Computer chose",second)
print ("You Win!")
else:
print ("You chose", first)
print ("Comuter chose", second)
print ("You lose.")
elif first == ("scissors"):
if second == ("paper"):
print ("You chose",first)
print ("Computer chose",second)
print ("You Win!")
else:
print ("You chose", first)
print ("Comuter chose", second)
print ("You lose.")

game(userHand,computerHand)
#1 · 9y ago
K4LI
K4LI
Quote Originally Posted by Poloh View Post
#poloh
import random

userHand = input("rock, paper, or scissors")
computerHand = random.random()

if computerHand < .33:
computerHand = ("rock")
elif computerHand < .66:
computerHand = ("paper")
else:
computerHand = ("scissors")


def game(first,second):
if first == second:
print ("You chose",first)
print ("Computer chose", second)
print ("It's a tie!")
elif first == ("rock"):
if second == ("scissors"):
print ("You chose",first)
print ("Computer chose",second)
print ("You Win!")
else:
print ("You chose", first)
print ("Comuter chose", second)
print ("You lose.")
elif first == ("paper"):
if second == ("rock"):
print ("You chose",first)
print ("Computer chose",second)
print ("You Win!")
else:
print ("You chose", first)
print ("Comuter chose", second)
print ("You lose.")
elif first == ("scissors"):
if second == ("paper"):
print ("You chose",first)
print ("Computer chose",second)
print ("You Win!")
else:
print ("You chose", first)
print ("Comuter chose", second)
print ("You lose.")

game(userHand,computerHand)
Put this inside the "CODE" tag in order to make it readable, moreover there is NO INDENTATION which is too bad in Python lol
#2 · 9y ago
Poloh
Poloh
Quote Originally Posted by K4LI View Post
Put this inside the "CODE" tag in order to make it readable, moreover there is NO INDENTATION which is too bad in Python lol
I was looking for that CODE function haha thanks!
#3 · 9y ago
AS
ASERHaerheadrherherh
Code:
#poloh
import random

userHand = input("rock, paper, or scissors")
computerHand = random.random()

if computerHand < .33:
    computerHand = ("rock")
elif computerHand < .66:
    computerHand = ("paper")
else:
    computerHand = ("scissors")


def game(first,second):
    if first == second:
        print ("You chose",first)
        print ("Computer chose", second)
        print ("It's a tie!")
    elif first == ("rock"):
        if second == ("scissors"):
            print ("You chose",first)
            print ("Computer chose",second)
            print ("You Win!")
        else:
            print ("You chose", first)
            print ("Comuter chose", second)
            print ("You lose.")
    elif first == ("paper"):
        if second == ("rock"):
            print ("You chose",first)
            print ("Computer chose",second)
            print ("You Win!")
        else:
            print ("You chose", first)
            print ("Comuter chose", second)
            print ("You lose.")
    elif first == ("scissors"):
        if second == ("paper"):
            print ("You chose",first)
            print ("Computer chose",second)
            print ("You Win!")
    else:
        print ("You chose", first)
        print ("Comuter chose", second)
        print ("You lose.")
game(userHand,computerHand)
Indented for easier reading.

Also, if you want to print on a new line, instead of doing three print statements, there should be some way to use a newline to put it all into one statement, idk how though.
#4 · 9y ago
Nimboso
Nimboso
Plus, since you're printing the users choice, and computers choice every time, you can print it above the if statements to remove a lot of repetition from your code.

Code:
print("You chose", first, "\nComputer chose", second)
if you care about using the newline over multiple print statements.
#5 · edited 9y ago · 9y ago
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

  • Rock, Paper, Scissor game. Random number generator not working.By samlarenskoog in C++/C Programming
    6Last post 10y ago
  • Rock paper scissor lizard spockBy Woods in General
    2Last post 14y ago
  • rock, paper, scissorsBy ace76543 in General
    5Last post 18y ago
  • Lock Mode V.2 & Paper/FatA*** Hack [ Source Code ]By Aeir in Piercing Blow Hack Coding/Source Code
    1Last post 14y ago
  • [Release]Scissors, rock, paperBy /b/oss in Visual Basic Programming
    21Last post 16y ago

Tags for this Thread

None