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 › Other Programming › Python Rock Paper Scissors.

Python Rock Paper Scissors.

Posts 1–4 of 4 · Page 1 of 1
VU
vuxane
Python Rock Paper Scissors.
Check my Python rock paper scissors out.

Code:
import random

options = ["Rock","Paper","Scissors"]
AI = random.choice(options)
user = raw_input("Pick either Rock, Paper or Scissors: ")
user = user.lower()
if user == 'rock' or 'paper' or 'scissors':
    print "The computer has drawn %s whilst you have drawn %s " % (AI,user)
if user == 'rock':
    if AI == 'Rock':
        print 'Tie Game'
    elif AI == 'Paper':
        print 'AI Wins'
    else:
        print 'User Wins'
if user == 'paper':
    if AI == 'Rock':
        print 'User Wins'
    elif AI == 'Paper':
        print 'Tie Game'
    else:
        print 'AI Wins'
if user == 'scissors':
    if AI == 'Rock':
        print 'AI Wins'
    elif AI == 'Paper':
        print 'User Wins'
    else:
        print 'Tie Game'
#1 · 8y ago
BLURREDDOGE
BLURREDDOGE
It's been a while since I've seen raw input used in python. Also, ew python 2.
#2 · 8y ago
Vox
Vox
Quote Originally Posted by BLURREDDOGE View Post
ew python 2
^ what they said
#3 · 8y ago
Vox
Vox
I took a stab at this using python 3.6.4 (My favourite). At first, i didn't want to try, as i thought i would just end up complicating things a lot more, but i actually think i did a pretty good job, and i had a lot of fun doing it as well.
Code:
import random
import sys

#this is a script i added a bit extra, bare minimum code is in spoiler below

def main():
    cheats = False
    if len(sys.argv) == 2:
        cheats = True if sys.argv[1] == "-c"


    choices = ["rock", "paper", "scissors"]
    computer_action = random.choice(choices)

    if cheats:
        print(f"Computer chose: {computer_action}")

    player_action = None
    while player_action == None:
        player_action = input("Choose your weapon: ").lower()

        if player_action not in choices:
            player_action = None

    computer_result = choices.index(computer_action)
    player_result = choices.index(player_action)

    if player_result != computer_result:
        if player_result != 2 and computer_result != 2:
            winner = "Computer" if computer_result > player_result else "You"

        elif computer_result > player_result:
            winner = "Computer" if player_result == 1 else "You"

        elif player_result > computer_result:
            winner = "You" if computer_result == 1 else "Computer"
    else:
        print("It's a Tie!")
        main()

    print(f"{winner} won!")
    sys.exit()

if __name__ == "__main__":
    main()
 
Bare Minimum

Code:
import random
#this is the bare minimum for (my) rock paper scissors.
#It removes error checking, and re-rolling on a tie, as well as letting python close itself.

choices = ["rock", "paper", "scissors"]

computer_action = random.choice(choices)
player_action = input("Choose your weapon: ").lower()

computer_result = choices.index(computer_action)
player_result = choices.index(player_action)

if player_result != computer_result:
	if player_result != 2 and computer_result != 2:
		winner = "Computer" if computer_result > player_result else "You"

	elif computer_result > player_result:
		winner = "Computer" if player_result == 1 else "You"

	elif player_result > computer_result:
		winner = "You" if computer_result == 1 else "Computer"
else:
	print("It's a Tie!")

print(f"{winner} won!")
#4 · edited 7y ago · 7y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • Rock Paper Scissors Source CodeBy Poloh in Coders Lounge
    4Last post 9y ago
  • 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
  • [Release]Scissors, rock, paperBy /b/oss in Visual Basic Programming
    21Last post 16y ago

Tags for this Thread

None