-
Notifications
You must be signed in to change notification settings - Fork 21
/
adventure.rb
35 lines (26 loc) · 1.14 KB
/
adventure.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'rubygems'
require 'bundler/setup'
require_relative 'db/setup'
require_relative 'models/page'
require_relative 'models/book'
page = Page.create(starting_point: true, content: "You wake up on a road. It's foggy and dampy. In your bag is 30 gold pieces and a bacon sandwich. Which do you choose?")
Page.create(conclusion: true, parent_id: page.id, content: "Go into the forest")
Page.create(conclusion: true, parent_id: page.id, content: "Walk down the road")
book = Book.new(page)
until book.complete_game? do
puts book.current_page.content
puts "your options: "
puts " - [#{book.current_page.options.first.content}]"
puts " - [#{book.current_page.options.last.content}]"
puts "What do you want to do? Enter A or B"
book.input( gets )
end
puts "------------------------------------------"
puts "| |"
puts "| |"
puts "| ADVENTURE COMPLETE |"
puts "| |"
puts "| |"
puts "------------------------------------------"
puts book.current_page.content
puts "hope you won!"