Create a gist now

Instantly share code, notes, and snippets.

The Belief Simulator (completed)
body
{
font-family:"courier new";
}
<head>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<meta charset=utf-8 />
</head>
<body>
<p><b>The Belief Simulator</p></b>
<div id="initialise"></div>
<div id="trueWorship"></div>
<div id="death"></div>
<div id="outcome"></div>
</body>
// Initialise random god variables
var godExists = true;
var exists = Math.random();
var oneTrue = Math.random();
var omniscient = Math.random();
var benevolent = Math.random();
godExists = random(exists);
var godTrue = random(oneTrue);
var godOmniscient = random(omniscient);
var godBenevolent = random(benevolent);
function random(isGod){
if (godExists) {
if (isGod > 0.5) {
return true;
} else {
return false;
}
} else {
return null;
}
}
// Initialise user variables
var userBelieves = false;
var userWorships = false;
var theOutcome = null;
// Initialise death
var death = Math.random();
var chosenDeath = "Good for you. <p>" + randomiseDeath(death);
function randomiseDeath(death){
if (death < 0.1) {
return "After watching a popular comedy, you find one scene so hilarious that you laugh continuously for 25 minutes, and probably would still be laughing, if your heart hadn't of stopped because of the effort.";
} else if (death < 0.2) {
return "On one of your romantic encounters on a roof, you mistake a balcony for a chimney and plunge to your death.";
} else if (death < 0.3) {
return "In desperation to elongate your life, you resort to using healthy foods. After drinking 10 gallons of carrot juice in 10 days, the vitamin A within the juice, while fantastic for the body in adequate quantities, accumulate in your liver and kill you through liver failure.";
} else if (death < 0.4) {
return "You participate in the International Sauna Competition in Finland, and as the person who resists the highest temperature (110 C), not only do you win, but you also present burns all over your body, you collapse in the sauna and die shortly after.";
} else if (death < 0.5) {
return "On a nature walk, you spot a feather on the ground, as you go to pick it up, the wind carries it over a guard railing set up to protect wanderers. You're so caught up with the feather that you dismiss this, and you topple off an 80-foot cliff. You sustain a head injury and die soon after.";
} else if (death < 0.6) {
return "You discover the delights of helium, and at an amusement park, you go into a giant helium filled balloon. What you don't realise is oxygen is a necessary part of breathing. At least you died laughing.";
} else if (death < 0.7) {
return "You believe that a window that you regularly look out of on the 24th story is unbreakable. To prove this to others, you sprint to the window and bounce back off, well that's what you thought would have happened. You plunge to your death. Don't bet your life on windows not crashing.";
} else if (death < 0.8) {
return "While trying to get home, you find that you're so off your head in mind altering substances, you cannot for the life of you (quite literally) do the key to your front door. Instead you go through an open window in front of a sink filled with water. Unfortunately you get stuck with your head in the sink and drown.";
} else if (death < 0.9) {
return "Long scarfs come back in fashion. Your scarf gets entangled in the wheel of your vehicle and you are strangled to death.";
} else {
return "Camping atop a mountain, you receive a call from a friend during a storm. Your phone is struck by lightning and you die instantly.";
}
}
function outcome() {
if (!godExists && !userBelieves && !userWorships) {
theOutcome = "You were right all along. There is nothing beyond life. Pity you never find out as you're rotting in the ground.";
} else if (!godExists) {
theOutcome = "Unfortunately God doesn't exist. Also you've wasted away your life on worshipping and pleasing a something that radically lacks empirical evidence.<p>Don't you feel silly.";
} else if (godBenevolent && !userBelieves) {
theOutcome = "As God is benevolent, but he reluctantly accepts you into his kingdom... after putting you in the naughty corner with the other prolific child smugglers and naturists, but thankfully, only for a short amount of time.";
} else if (godExists && !userBelieves) {
theOutcome = "Looks like you were wrong the entire time. There is a God, but you spend the rest of eternity with all your non-believing friends with slight inconveniences. For example, the itch on the back of your ear that you cannot itch enough to satisfy.";
} else if (godBenevolent) {
theOutcome = "God is benevolent. He cares not for your frivolous worshipping. Welcome to heaven, where you eat and bathe in honey for eternity and bounce amongst the edible cotton candy clouds.";
} else if (userWorships && !godTrue) {
theOutcome = "God sees through you and dispises you for your God-Feared inspired worshipping. You are sent to a shallow depth of Hell reserved for all those who committed crimes such as following a life of materialism, working in finance, or indulging in the hedonistic activity of extremely violent video games.";
} else if (!godTrue) {
theOutcome = "Unfortunately you didn't worship the correct God. You reincarnate to be a dung beatle, cursed with immortality.";
} else if (godTrue) {
theOutcome = "Congratulations! You've arrived at the pearly gates of heaven. You enjoy the rest of eternity with every single relative (which according to The Bible, is every single person since we were all descended through inbreeding from Adam and Eve). Isn't it wonderful.<p>Enjoy your perpetual orgasms.";
} else {
theOutcome = "You are really odd. You should stay on Earth a little longer.";
}
$('#outcome').html(theOutcome);
}
// Print out cheats
console.log("NEW GAME ===========", "exists: " + godExists, "correct god: " + godTrue, "is omniscient: " + godOmniscient, "benevolent: " + godBenevolent);
// Start game
$("#initialise").append("Do you believe in GOD?");
$("#initialise").append("<div id='godBelief'><input type='radio' value='belief' name='belief' checked ='checked'><label for='belief'>Yes</label><input type='radio' value='nonBelief' name='belief'><label for='nonBelief'>No</label></div>");
$("input[name='belief']").click(function trueWorship() {
var choice = '';
var value = $(this).attr('value');
if (value == "belief") {
choice += chosenDeath;
userBelieves = true;
$('#trueWorship').html("");
$('#death').html(choice);
outcome();
}
else {
choice += "You might as well. There's no harm in doing so if it will secure yourself a place in heaven.<br><div id='worship'><input type='radio' value='doesWorship' name='worship' checked ='checked'><label for='doesWorship'>Fine, whatever.</label><input type='radio' value='doesNotWorship' name='worship'><label for='doesNotWorship'>Go away.</label></div>";
$('#trueWorship').html(choice);
}
$("input[name='worship']").click(function worshipping() {
var choice = '';
var value = $(this).attr('value');
if (value == "doesWorship") {
userWorships = true;
userBelieves = true;
}
choice += chosenDeath;
$('#death').html(choice);
outcome();
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment