generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: RockPaperScissor Challenge[FOR PYTHON SCRIPTERS]

Previous Thread :: Next Thread 
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
23 Jan 2016 03:04 PM
create a RockPaperScissors basic input output game where for the win/lose logic you cannot use if/elif/else for ex: you cannot do some thing like player_choice === "rock" and computer_choice === "scissors" ... player wins. Of course I have done this challenge and have the code but I want to see someone else do this good luck fellow pythonists.
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
23 Jan 2016 03:07 PM
Little mistake it's == not === damn you javascript
Report Abuse
Funification is not online. Funification
Joined: 22 Jun 2015
Total Posts: 3622
23 Jan 2016 03:14 PM
OK Later



Funification | Was dominusawesomus | you wil cryying when obama take yur computr |Yee | ParanoidHumanoid is my trading account
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Jan 2016 03:16 PM
-- 0 is rock
-- 1 is paper
-- 2 is scissors
function p()io.read();return math.random()<0.5;end

has user input
user wins 50% of the time

no need for all that other crap :)
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Jan 2016 03:17 PM
oops ignore that

-- 0 is rock
-- 1 is paper
-- 2 is scissors

stuff
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 03:25 PM
function p()io.read();return math.random()<0.33;end -- 1/3 lose, 1/3 tie
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Jan 2016 03:26 PM
oh

oops
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Jan 2016 03:27 PM
function p()io.read();x=math.random();return x<0.33 and 0 or x<0.66 and 1 or 2;end

that returns 0 for loss 1 for tie 2 for win
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
23 Jan 2016 03:27 PM
Entire code anyone?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 03:28 PM
This IS the entire code Threadboy

function p()io.read();return math.random()<0.33;end p()
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
23 Jan 2016 03:29 PM
my implementation
------------------
from random import randint

selections = ["rock", "paper", "scissors"];

def determineWinner(user, computer):

if user == computer:
return "It's a tie";

winMatrix = [[False, False, True], [True,False,False],[False, True, False]];

if winMatrix[selections.index(user)][selections.index(computer)] == True:
return "You won!";
return "You lost";

user_selection = input("Rock, Paper or Scissors?").lower();

while user_selection not in selections:
user_selection = input("Rock, Paper or Scissors?").lower();

AI_selection = selections[randint(0,2)];

print "You: %s" %(user_selection);
print "Computer: %s" %(AI_selection);

print determineWinner(user_selection, AI_selection);
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
23 Jan 2016 03:29 PM
It sounds like OP is having you guys do his programming assignment.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 03:30 PM
You're bad a code golf. Even in Python, this is much more straightforward.
Port
function p()io.read();return math.random()<0.33;end p()
to Python.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 03:31 PM
"It sounds like OP is having you guys do his programming assignment."
That moment when you're ninja'd with counter-evidence.
Report Abuse
iPhynx is not online. iPhynx
Joined: 25 Jul 2011
Total Posts: 3271
23 Jan 2016 03:33 PM
Put it onto GitHub. Enjoy :)
gyazo.com/4208c54f9693ad84b7f43619f12892de
I did it as quick as I can, yeah, it's extremely messy.
Yeah, I could've used a dictionary... It works, okay?

I also made this earlier:
gyazo.com/8399f1da89097089e8e18943665f9bcf

Both codes run on Python 3

--Programmer /noun/ def. A machine that is used to convert caffeine into code--
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
23 Jan 2016 03:34 PM
Don't know what a code golf is but ok...
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Jan 2016 03:34 PM
takes screenshot of github link and posts that link

nice logic
Report Abuse
iPhynx is not online. iPhynx
Joined: 25 Jul 2011
Total Posts: 3271
23 Jan 2016 03:35 PM
Holy crap, yeah it's messy AF.
I only beautify code if I have time. I only think logically if I have coffee. I only had tea today.

--Programmer /noun/ def. A machine that is used to convert caffeine into code--
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 03:36 PM
Okay, here's some Lua code for Rock Paper Scissors.


io.read();print(math.random()<0.33)

It runs Rock Paper Scissors once and if you win, it prints "true".
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Jan 2016 03:36 PM
phynx ur code isnt even on github
Report Abuse
iPhynx is not online. iPhynx
Joined: 25 Jul 2011
Total Posts: 3271
23 Jan 2016 03:36 PM
It's the only way, Forever. ROBLOX Admins would feast on my flesh if I posted the GitHub link...
And bro, how dafaq do you not know what Code Golf is?
You can pick any language and complete the task presented to you.
The person with the smallest code wins (the code with the least Bytes).

--Programmer /noun/ def. A machine that is used to convert caffeine into code--
Report Abuse
iPhynx is not online. iPhynx
Joined: 25 Jul 2011
Total Posts: 3271
23 Jan 2016 03:38 PM
@Forever - It's there, I logged out and checked. Download the .zip you dumbass.

--Programmer /noun/ def. A machine that is used to convert caffeine into code--
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 03:38 PM
takes screenshot of github link and posts that link [2]

Github and Gyazo are both banned, so it doesn't really make a difference.
Report Abuse
iPhynx is not online. iPhynx
Joined: 25 Jul 2011
Total Posts: 3271
23 Jan 2016 03:40 PM
I can't believe how much I could've simplified my code and still display what the PC chose etc. Ugh, stupid me.

--Programmer /noun/ def. A machine that is used to convert caffeine into code--
Report Abuse
iPhynx is not online. iPhynx
Joined: 25 Jul 2011
Total Posts: 3271
23 Jan 2016 03:40 PM
ROBLOX doesn't give two shts about Gyazo. It isn't banned.

--Programmer /noun/ def. A machine that is used to convert caffeine into code--
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image