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.")
I love this, except for
i
i hatei
.And maybe the fact that you have to continue until the gun actually fires :|
You can
quitcontrol-c at any point. Sometimes, the game plays you.
but it’s easier than thinking of a useful variable name.
bullet_idx
Like bullet?
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
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.
You forgot the switch.
That can’t remove a directory.
Perfectly safe on Windows, too. The remove() function doesn’t work on directories.
Remove-Item -LiteralPath "C:" -Force -Recurse
I’m curious. Does anyone like PowerShell, and the syntax you end up with?
Yeah I’m a big fan of it. People complain about the verbosity of it but I like that for readability and autocomplete makes that a non issue I find. Plus if you really want to save on typing when using it as a terminal tool you can just make aliases for all your common commands.
No complaints from me. Maybe if I had to use it. The thing that strikes me as particularly noisy is what seems to be either case insensitive commands and flags, or case sensitive and using Pascal-Case for both commands and flags. Which would be my least preferred option.
I work pretty frequently with PS and have no issues with syntax. It’s easy to read and you always have autocomplete so there is just 1 extra click to get from -r to -Recurse. Same command could be also written as this due to alias feature.
rm 'C:' -r -fo
It’s just not the best practice since in PowerShell it is recommended to not use aliases for readability reasons. Also less chance to mess things up due to how verbose all commands and their parameters are.
Thanks for the info! Is a correct assumption that this is a “yes”, to my question?
It is. Besides some very niche bugs everything in the core of PowerShell seems logical to me and easy to understand.
And Windows nowadays have like dozen of different security measures that stop you from removing critical system components. It is not like in Windows 95 days, that OS allowed you to remove kernel by just typing a single command.
And much like Windows, everything dangerous is done better elsewhere.
Wow, a Lain meme was not something I was expecting.
I should watch that show again sometime, I still have the DVDs somewhere I think.
“And you don’t seem to understand…”
A shame you seemed an honest man…
Fuck off, I know what I’m doing.
Omg someone please help how did I get this far they’re going to realize I’m stupid when they fire me everything will collapse because it’s all in a single excel file I need to figure out how to live in a tent in the woods and hunt and forage
Thought I’m on lainchan for a minute
Oh hell, you gave me a PTSD flashback!
It’s the late 90s. My mother suddenly discovers File Explorer on her refurbished commodity Wintel box and decides that all this messy clutter has to go. Never mind that the drive was 80% empty when delivered and I didn’t expect her to come close to filling it before it was replaced. Fortunately I had already backed up everything that looked important or interesting.
One day she calls from the office, “I don’t need this ‘Windows’ any more, do I?”
“What? Wait! Don’t do anything!” I walk in and she’s got C:/Windows highlighted and the cursor is hovering over “Delete”.
“I already have Windows installed on this computer, so I don’t need this any more, do I?” Spoken more as a statement than a question. It took several minutes of forced calm explanation to get her to accept that this “Windows” directory WAS the Windows that’s installed on the machine. She still wasn’t happy that she could see it in File Explorer, though. So untidy!
isn’t
randint
range inclusive? thusrandom.randint(0, 6) == 1
has a 1 in 7 chance, not 1 in 6. Most revolvers, assuming this is emulating russian roulette, have 6 cylinders, not 7.You’re right. I didn’t make this, but maybe the creator was accounting for the round in the chamber? I don’t guns, so no clue.
Revolvers don’t have the concept of one-in-the-chamber, only semi-auto pistols do, and you can’t play russian roulette with semi-autos :P (well you could, but 99% of the time, barring unexpected jams, the first person to go would lose)
Anyway I’m guessing it’s a bug :) - as the saying goes “no code is too short to be bug-free”
Good to know! Makes it easier to decide what to get next time I play Russian roulette.
Let’s all love lain.