Share your repls and programming experiences

← Back to all posts
Rock Paper Scissors in One Line!
SlickAssassin (5)

Sorry to your brain.

I know this is awful, I did it to see if I could make a nice RPS game that not only looks good but functions well, in one, singular, awful, terrible, looking line.

RPS Features:

  • Error catching, invalid key (not r, rock, p, paper, s, scissors)
  • Scoreboard, win vs loss for you and the Computer
  • A computer to play against lol (literally just random.choice)
  • Terrible looking code put all in one singular line.

Only setback

  • Loss is assumed upon a tie. Sorry, could fix it, I just don't want to, had enough of all this crap. The documentation would have to be partially redone and for a small project like this, it's just not worth it.

If you want to be able to read the weird way I did it (I did not start with multiple lines so I problem solved on the fly to make it work) check out

I have added a bunch of comments to help you understand what does what and why I use it the way I do.

If you want to try and read the awful one line of code you can check out

Some resources on what I used.

  • Execute token: exec('...') - Read the Docs
  • Lambda token: x = lambda {vars}: {single expression}; - Read the Docs
    • I combined lambda with exec to make the bulk of this dumb script.

One last thing, I know it's not super complicated but I want to put it here because too many people use {str_object}.format() instead of f'{variable} text'. Please learn about F-strings - Read the Docs

Whippingdot (567)

Poggers but simple program i think so... 😟

SlickAssassin (5)

I hate code that looks like this but I took a shot at doing it myself, it's by no means quicker but it does look cool! LOL @DynamicSquid

Whippingdot (567)

wait are you the real DynamicSquid cause you used to have 5000+ cycles if im right... @DynamicSquid