Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bren Cavallo - Choose your own adventure #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# Choose Your Own Adventure

Create a [Choose Your Own Adventure](http://en.wikipedia.org/wiki/Choose_Your_Own_Adventure#Format) game. [Here](https://writer.inklestudios.com/stories/musgraveritual) is a fancy web-based example, but creating yours as text-only, command-line based is fine.

Submit a pull request to this repository with all the necessary files, and replace this README with a description of your game and how to run it. Make sure to give the user instructions in the game about how to play, get help, etc.
To run this choose your own adventure, download and run the file advbook.rb. There will be instructions on how to proceed from there.
25 changes: 25 additions & 0 deletions advbook.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require './story.rb'

page = $page_0

loop do
puts "\e[H\e[2J"
puts page.content
if page.links.empty?
puts "\nTo restart type r.\n\nTo quit type q"
dec = $stdin.gets.chomp
if dec == 'r'
page = $page_0
puts "\e[H\e[2J"
puts page.content
end
abort('Goodbye!') if dec == 'q'
end
to_page = $stdin.gets.chomp
abort('Goodbye!') if to_page == 'q'
until page.links.include?(to_page.to_i)
puts 'Please enter a valid page number.'
to_page = $stdin.gets.chomp
end
page = $book[to_page.to_i]
end
12 changes: 12 additions & 0 deletions page.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is the class that implements Page.
# It allows one to create a page that
# consists of content and links to new
# pages

class Page
attr_accessor :content, :links
def initialize(content, *links)
self.content = content
self.links = *links
end
end
188 changes: 188 additions & 0 deletions story.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
require './page.rb'

$book = []

$page_0 = Page.new(
''"Welcome to \"Finding My Past\". To get started,
type 1. To abort type q."'',
1)

$book << $page_0

$page_1 = Page.new(
''"\"Bobby, have you finished getting dressed\", my wife called up

the stairs. It was 15 minutes until guests would start arriving for

my Sunday night dinner. I was running a bit behind schedule.

To set up snacks and drinks by the TV type 2.

To fire up the grill type 3."'',
2,
3)
$book << $page_1

$page_2 = Page.new(
''"If I learned anything growing up, it was that you can't watch football

without snacks and some Alamo beer. For the beer, I was covered by the

kegerator in the den, but I forgot the potato chips that my insufferable

father in law insists upon.

To go to the store to pick up chips type 4.

To tell off my father in law type 5."'',
4,
5)
$book << $page_2

$page_3 = Page.new(
''"Ever since my father lost his vision due to propane poisoning, I've

taken over as my family's grill master. Despite all this, he still

insists that I cook with propane and in fact, even blames himself and

not propane nor the shoddy equipment his boss used that slowly took his

vision away over the last many years. As I fire up the grill, my wife

calls in saying that my old friend Joseph will be showing up on short

notice. I haven't spoken to Joseph in years, not since my wife, Connie,

decided to marry me over him. He didn't even attend wedding. If Joseph

comes to dinner tonight I'd be one steak short.

To go to the store to buy an extra steak type 4.

To continue working on the bbq type 6."'',
4,
6)
$book << $page_3

$page_4 = Page.new(
''"I only had 10 minutes for guests to arrive so I gunned it down to the

Mega-Lo-Mart. My heart stopped when I saw that the greeter was my childhood

bully Clark Peters. \"Hey Bobby\" he snarled. Just what

I'd always hear before he'd knock me over and shove dirt in my face. Clark

only continued making poor life choices as he entered and dropped out of

high school. \"Oh hey Clark\" I said, hoping I could end this encounter

as quickly as possible. Before I knew it, he punched me in the face

and had me pinned to the ground. My last thoughts were of my guests and

their empty plates tonight at dinner"''
)
$book << $page_4

$page_5 = Page.new(
''"My father in law always treated me terribly. Ever since I was a

chlid. Tonight would be a great time to finally stand up to him. Well it looks

like the first guests are arriving.

To let them in type 7.

To put on a silly outfit type 8."'',
7,
8)

$book << $page_5

$page_6 = Page.new(
''"I salivate as the propane cooks the steaks to the

appropriate doneness. The smell takes me back to my childhood.

The first knocks on the door happen as the meat gets that perfect

rare quality that we love in Texas.

To let the guests in type 9.

To try to eat all the steaks before dinner type 10."'',

9,
10)

$book << $page_6

$page_7 = Page.new(
''"Oh great. The first guests are the in laws. My father in law

never liked me and he was always against the wedding. I think he was forced

by his somewhat more even tempered wife to continue to associate with us

so that they'd at least be able to see their grandchild. He walked

towards the couch expecting to see his favorite Sriracha flavored potato

chips. As he notices their absence he begins to shout

\"Bobby you redneck. You never respect your elders. I can't believe I

let my daughter marry this fat hick.\" It was just too much. I wanted

to be strong, but instead I ran to my room in tears."'')

$book << $page_7

$page_8 = Page.new(
''"No party is complete without my old Donald Duck costume. That

costume even got me through high school as \"Sailor Bobby\". I put on my

costume and head downstairs. My wife let in my cousin Luanne and her husband

Lucky. I always like seeing Lucky because no 50 year old can party quite

like him. I leave the hosting duties to my wife as we sit down for our

first of many beers for the evening. It will be someone elses problem to

get this passed out 400 pound sailor off the couch."'')

$book << $page_8

$page_9 = Page.new(
''"Just as I feared, the first guest was Joseph. We both knew this

was going to be awkward. \"Bobby, I have to apologize. We both loved Connie,

but your friendship has always been the most important part of my life.\" We

both started crying and then hugged. This display of emotion would have been

uncommon among my parents generation, but in 2030, Texas men have embraced

their sensative side. Joseph and I catch up as the other guests arrive. At

the dinner table I gave Joseph my steak. We eat on a picnic table under

the stars. My parents are there as are some of our oldest childhood friends.

The music of Chuck Mangione can be heard distantly in the background."'')

$book << $page_9

$page_10 = Page.new(
''"The steak is too much for me to resist. Just so juicy.

My family looks on in disgust as I chow down the final steak. I've

successfully ruined another dinner party"'')

$book << $page_10