Skip to content

Instantly share code, notes, and snippets.

@bentayloruk
Created September 15, 2018 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bentayloruk/5792276e3b50bd677c13c15ffe1d46b5 to your computer and use it in GitHub Desktop.
Save bentayloruk/5792276e3b50bd677c13c15ffe1d46b5 to your computer and use it in GitHub Desktop.
Poppy Graham's Sleeping Game
open System
open System
open System.ComponentModel
let readLine () =
Console.ReadLine().ToLower()
let exit () =
printfn "\r\nByyyyyyyyyyeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzz\r\n"
0
let loser () =
printfn "you snooze you lose, sucker. i'm squishing your brain."
0
let finalRoom hasFurCoat =
printfn "you are in a room, there are two buttons, a red button and a blue button. press r or b"
let answer = readLine()
if answer = "r" then
// Red button with lava.
printfn "lava is red and it just fell on your head."
printfn "you die slowly and that is a bad way to die "
loser()
elif answer = "b" then
// Blue button with snow.
printfn "loads of snow and ice drops from the roof and buries you..."
if hasFurCoat = true then
printfn "...don't worry, you survied as you wore the fur coat sleep safe and sound dont let the bugs bite"
exit()
else
printfn "you had nothung to protect you, you drowend in the snow. nighty night, all the bed bugs did bite"
exit()
else
printfn "i give up, you can't type properly."
exit()
let rec playGame() =
printfn "welcome to the sleeping game! (PEGI 12+)\r\n"
printfn "you are in your house fast asleep"
printfn "we are controlling your dreams your are going to have to choose wisely\r\nare you ready to play (Y or N?)?"
let readyToPlayAnswer = readLine()
if readyToPlayAnswer = "y" then
// Do the door question
printfn "you are stuck in a room and there is 3 doors and you have to pick one of them they are all death situations"
printfn "room one is full of lava"
printfn "room two contains a lion that's not eaten for 10 years"
printfn "room three contains an electric chair\n\r\nwhich room do you choose? 1, 2 or 3?"
let roomNumber = readLine()
if roomNumber = "1" then
printfn "why that one you fool? you die slowly in the worst pain..."
exit()
elif roomNumber = "2" then
printfn "well done, the lion is actually dead, so you are safe. you pick up his lovely skin so you can use it as a fur coat."
finalRoom true
elif roomNumber = "3" then
printfn "why would you choose number 3 you silly billy you would die instantly fortunately for you the chair is not working very well it maked your hair go fuzzy "
finalRoom false
else
printfn "you can't read or type very well, we've turned off your brain"
exit()
elif readyToPlayAnswer = "n" then
printfn "you are all alone now for the rest of you whole entire life, you should have played..."
exit()
else
printfn "wrong answer dummy, let's try again."
playGame()
[<EntryPoint>]
let main argv =
playGame()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment