You are viewing a single thread.
View all comments
64 points

You call that russian roulette? This is real russian roulette. Dying is a 1/6 probability.

#!/usr/bin/env python3
import random

barrel = [0, 0, 0, 0, 0, 1]
random.shuffle(barrel)

print("Russian Roulette")
for i in barrel:
  input("Press enter to shoot")
  if i == 1:
    print("You are dead.")
    exit()
  else:
    print("Phew. You survived.")
permalink
report
reply
20 points

I love this, except for i i hate i.

permalink
report
parent
reply
16 points

And maybe the fact that you have to continue until the gun actually fires :|

permalink
report
parent
reply
10 points

You can quit control-c at any point. Sometimes, the game plays you.

permalink
report
parent
reply
11 points

but it’s easier than thinking of a useful variable name.

permalink
report
parent
reply
5 points

bullet_idx

permalink
report
parent
reply
3 points

Like bullet?

permalink
report
parent
reply
3 points

I always use i because I’m too lazy to type out iterator when I’m making my garbage spaghetti code that will support infrastructure for years

permalink
report
parent
reply
1 point
*
Removed by mod
permalink
report
parent
reply
1 point

I like it, i for int easy to remember. I also use i, j, k as u it vectors and remember at what depth of a multidimentional array in working at.

permalink
report
parent
reply
1 point

You forgot the switch.

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 7.1K

    Monthly active users

  • 954

    Posts

  • 36K

    Comments