Quantcast
Channel: Debian User Forums
Viewing all articles
Browse latest Browse all 3557

General Debian • Share your Debian SCRIPTS

$
0
0
A Russian Roulette Simulator - because I'm watching The Deer Hunter. ;) Disclaimer: I am not trying to trivialize a serious issue, so please don't take offense: This is for entertainment and educational use only.

Code:

#!/bin/bashecho "Welcome to the Russian Roulette Simulator!"# Number of chambersnum_chambers=6# Load a bullet in a random chamberbullet_chamber=$((1 + RANDOM % num_chambers))# Function to pull the triggerpull_trigger() {    outcome=$((1 + RANDOM % num_chambers))    [ "$outcome" -eq "$bullet_chamber" ] && echo "BANG! You got the bullet. Game over!" || echo "Click. You survived this round."}# Prompt trigger pullread -p "Press Enter to pull the trigger..."# Call the pull_trigger functionpull_trigger

Statistics: Posted by Hallvor — 2023-12-28 22:51 — Replies 81 — Views 32262



Viewing all articles
Browse latest Browse all 3557

Trending Articles