2nd August 2015
0 views

Rock, Paper, Scissors [Python]

Made by rami in Inventions

veteran
Master
3,733 posts
2,689
Seen 31st August 2023
3rd August 2015, 02:07 PM

Ouph, im very confused :?
0

total trash
Master
3,372 posts
3,394
Seen 14th March 2016
3rd August 2015, 02:58 PM

Sr PeTaL wrote on 2nd August 2015 02:58 PM:
Rock Paper Scissors



Ok, this is going to be simple and straight forward, it's a rock, paper scissors script I made for fun in python, you can mess around with this and it's really easy just did it to burn some time.

Just go to this link to run it V:
https://trinket.io/python/e8631e4fb5?outputOnly=true

here's the code
Regular Version:

import random;
import time;

def rps():
print ("Welcome to Rock, Paper, and scissors..\n")
time.sleep(1)
playerC = raw_input("What is your choice? ")

if (playerC != "rock" and playerC != "paper" and playerC != "scissors"):
print('Invalid Choice')
exit()

else:
pass

computerC = random.randint(0, 2)

if (computerC == 0):
computerC = "rock"

elif (computerC == 1):
computerC = "paper"

elif (computerC == 2):
computerC = "scissors"

if(computerC == playerC):
print('Tie! Restarting again')
time.sleep(1)
rps()

if(computerC == "rock" and playerC == "paper"):
print('You did it! You won, Congratulations!')
exit()

if(computerC == "rock" and playerC == "scissors"):
print('You lost! You failed your mission to save your people! Over reacting, sorry!')
exit()

if(computerC == "paper" and playerC == "rock"):
print('You lost! Bye bye!')
exit()
if(computerC == "paper" and playerC == "scissors"):
print('You won! Congrats, say something to the camera!')
camera = raw_input()
print("Well! " + camera + " to you too!")
time.sleep(5)
exit()
if(computerC == "scissors" and playerC == "rock"):
print("You won! Congrats brave knight!")
exit()
if(computerC == "scissors" and playerC == "paper"):
print("You sadly lost! You fought well though :)")
exit()



Does it cost money to use the site?
0



jdg
Member
1,404 posts
2,110
Seen 10th August 2023
3rd August 2015, 03:06 PM

Allie wrote on 3rd August 2015 02:58 PM:
Sr PeTaL said on 2nd August 2015 02:58 PM:
Rock Paper Scissors



Ok, this is going to be simple and straight forward, it's a rock, paper scissors script I made for fun in python, you can mess around with this and it's really easy just did it to burn some time.

Just go to this link to run it V:
https://trinket.io/python/e8631e4fb5?outputOnly=true

here's the code
Regular Version:

import random;
import time;

def rps():
print ("Welcome to Rock, Paper, and scissors..\n")
time.sleep(1)
playerC = raw_input("What is your choice? ")

if (playerC != "rock" and playerC != "paper" and playerC != "scissors"):
print('Invalid Choice')
exit()

else:
pass

computerC = random.randint(0, 2)

if (computerC == 0):
computerC = "rock"

elif (computerC == 1):
computerC = "paper"

elif (computerC == 2):
computerC = "scissors"

if(computerC == playerC):
print('Tie! Restarting again')
time.sleep(1)
rps()

if(computerC == "rock" and playerC == "paper"):
print('You did it! You won, Congratulations!')
exit()

if(computerC == "rock" and playerC == "scissors"):
print('You lost! You failed your mission to save your people! Over reacting, sorry!')
exit()

if(computerC == "paper" and playerC == "rock"):
print('You lost! Bye bye!')
exit()
if(computerC == "paper" and playerC == "scissors"):
print('You won! Congrats, say something to the camera!')
camera = raw_input()
print("Well! " + camera + " to you too!")
time.sleep(5)
exit()
if(computerC == "scissors" and playerC == "rock"):
print("You won! Congrats brave knight!")
exit()
if(computerC == "scissors" and playerC == "paper"):
print("You sadly lost! You fought well though ")
exit()




Does it cost money to use the site?
No, i didn't code my script on that website, I just put it there so you can see it.
0

  • "Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

Veteran
Master
3,526 posts
9,634
Seen 31st August 2023
3rd August 2015, 06:02 PM

Seems like a lot of you are confused.

Python is a programming language used to make bots and working codes like Petal did. Ignore the code Petal wrote, it's just the code he used to make the Rock Paper Scissors. Click on his link and type in your choice. You can click Run to restart the match
1

+1 by rami
"Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

jdg
Member
1,404 posts
2,110
Seen 10th August 2023
3rd August 2015, 06:37 PM

Hashir wrote on 3rd August 2015 06:02 PM:
Seems like a lot of you are confused.

Python is a programming language used to make bots and working codes like Petal did. Ignore the code Petal wrote, it's just the code he used to make the Rock Paper Scissors. Click on his link and type in your choice. You can click Run to restart the match

Taking javascript now with node.js
0

  • "Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

hot eyebrows
Master
1,101 posts
1,812
Seen 1st June 2023
3rd August 2015, 10:20 PM

Even with the explanation on what Python is, I still don't get the coding...or the whole website thing 0.0
0

Foot

jdg
Member
1,404 posts
2,110
Seen 10th August 2023
4th August 2015, 05:46 AM

Cristal412 wrote on 3rd August 2015 10:20 PM:
Even with the explanation on what Python is, I still don't get the coding...or the whole website thing 0.0

.. Ignore the website, it's just to RUN the script. Python is a programming language, there are different types of languages.
0

  • "Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

Moderator
269 posts
1,383
Seen 31st August 2023
4th August 2015, 08:40 AM

Very nice work.
Although I would recommend one thing, which could prevent confusion for players:

Where you have playerC = raw_input("What is your choice? ")
you should change that to
playerC = raw_input("What is your choice? ").lower()

Why? Well, if a user just so happened to have caps lock on or something like that, if he had any capitals letters in his choice, it'd say it was an invalid choice.
I know it's not very important for a game as simplistic as this, but as I know you're new to Python, it's worth noting for more advanced future projects!
1

+1 by rami
Adam

jdg
Member
1,404 posts
2,110
Seen 10th August 2023
4th August 2015, 08:54 AM

Wheeler wrote on 4th August 2015 08:40 AM:
Very nice work.
Although I would recommend one thing, which could prevent confusion for players:

Where you have playerC = raw_input("What is your choice? ")
you should change that to
playerC = raw_input("What is your choice? ").lower()

Why? Well, if a user just so happened to have caps lock on or something like that, if he had any capitals letters in his choice, it'd say it was an invalid choice.
I know it's not very important for a game as simplistic as this, but as I know you're new to Python, it's worth noting for more advanced future projects!
Thanks man! After all, you're the best at python :D ( great teacher too. )
1

+1 by Wheeler
  • "Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

Member
211 posts
122
Seen 4th September 2015
4th August 2015, 12:48 PM

oh cool, maybe I'll try it! :)
1

+1 by rami


Hey! I am Lauren12.

Abby1 | Kadencedj | Katnip | Liv8757 | MikeSchmdit | Pancakes15 | cheilsea7 | foxyguy | harry0potter | lovely56 | sparklewater | lily1117 | Milkshake8 | Cowffee | Sadie | Foxehhhh | Starflower | Hashir | Paperback | lulu2 | Cristal412 | sydney123 | Lita | Ohiotoo/BlackandWhite |

If I forgot you please tell me. If you would like to be friends just ask! :3



jdg
Member
1,404 posts
2,110
Seen 10th August 2023
4th August 2015, 02:39 PM

Lauren12 wrote on 4th August 2015 12:48 PM:
oh cool, maybe I'll try it!
Awesome, thanks. :)
0

  • "Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

Master
5,463 posts
9,577
Seen 11th January 2023
6th August 2015, 06:03 AM

Ah Python is a great programming skill to know. I'm currently learning it at school and it's amazing what you can do with the code that you make!
1

+1 by rami

jdg
Member
1,404 posts
2,110
Seen 10th August 2023
6th August 2015, 06:37 AM

Luke wrote on 6th August 2015 06:03 AM:
Ah Python is a great programming skill to know. I'm currently learning it at school and it's amazing what you can do with the code that you make!
Thanks and good luck at school! btw, after you finish python in school, since they never go to the advanced stuff, look up python sockets.C:
0

  • "Behind this mask there is more than just flesh. Beneath this mask there is an idea... and ideas are bulletproof." -V

Login or join the forums to reply.