pie 0.1.3 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/bin/pie +31 -0
- data/bin/pie~ +31 -0
- data/lib/direction.rb +56 -0
- data/lib/pie.rb +36 -155
- data/lib/pie.rb~ +34 -155
- data/lib/pie_server.rb +20 -0
- data/lib/pie_server.rb~ +21 -0
- data/lib/place.rb +47 -0
- data/views/game_screen.erb +6 -4
- metadata +11 -9
- data/lib/player.rb +0 -13
- data/views/game_screen.erb~ +0 -67
- data/views/image_page.erb~ +0 -57
data/README.md
CHANGED
data/bin/pie
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
if RUBY_VERSION < "1.9.0"
|
3
|
+
puts "Error: pie requires Ruby 1.9, please use RVM."
|
4
|
+
exit
|
5
|
+
end
|
6
|
+
|
7
|
+
if ARGV.size == 0
|
8
|
+
puts "Usage: pie myfile"
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
pie_file = ARGV.first
|
13
|
+
pie_file = "#{pie_file}.pie" unless File.exist?(pie_file)
|
14
|
+
|
15
|
+
unless File.exist?(pie_file)
|
16
|
+
puts "Unknown file #{ARGV.first}, please try again."
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'pie'
|
22
|
+
rescue LoadError
|
23
|
+
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
24
|
+
require 'pie'
|
25
|
+
end
|
26
|
+
|
27
|
+
include Pie
|
28
|
+
load pie_file
|
29
|
+
|
30
|
+
require 'pie_server'
|
31
|
+
WebApp.run! :port => 31415
|
data/bin/pie~
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
if RUBY_VERSION < "1.9.0"
|
3
|
+
puts "Error: pie requires Ruby 1.9, please use RVM."
|
4
|
+
exit
|
5
|
+
end
|
6
|
+
|
7
|
+
if ARGV.size == 0
|
8
|
+
puts "Usage: pie myfile"
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
pie_file = ARGV.first
|
13
|
+
pie_file = "#{pie_file}.pie" unless File.exist?(pie_file)
|
14
|
+
|
15
|
+
unless File.exist?(pie_file)
|
16
|
+
puts "Unknown file #{ARGV.first}, please try again."
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'pie'
|
22
|
+
rescue LoadError
|
23
|
+
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
24
|
+
require 'pie'
|
25
|
+
end
|
26
|
+
|
27
|
+
include Pie
|
28
|
+
load pie_file
|
29
|
+
|
30
|
+
require 'pie_server'
|
31
|
+
WebApp.run!
|
data/lib/direction.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Pie
|
2
|
+
|
3
|
+
class DeadEnd < String
|
4
|
+
def dead_end?
|
5
|
+
true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Direction < String
|
10
|
+
def opposite(display_name = nil)
|
11
|
+
if display_name
|
12
|
+
@display_name = display_name
|
13
|
+
else
|
14
|
+
@display_name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def dead_end?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def direction(forward, back)
|
23
|
+
dir = Direction.new(forward)
|
24
|
+
dir.opposite(back)
|
25
|
+
dir
|
26
|
+
end
|
27
|
+
|
28
|
+
def north
|
29
|
+
@north ||= direction('Go North', 'Go South')
|
30
|
+
end
|
31
|
+
|
32
|
+
def south
|
33
|
+
@south ||= direction('Go South', 'Go North')
|
34
|
+
end
|
35
|
+
def east
|
36
|
+
@east ||= direction('Go East', 'Go West')
|
37
|
+
end
|
38
|
+
def west
|
39
|
+
@west ||= direction('Go West', 'Go East')
|
40
|
+
end
|
41
|
+
def dead_end(name)
|
42
|
+
DeadEnd.new(name)
|
43
|
+
end
|
44
|
+
def north!
|
45
|
+
dead_end(north)
|
46
|
+
end
|
47
|
+
def south!
|
48
|
+
dead_end(south)
|
49
|
+
end
|
50
|
+
def east!
|
51
|
+
dead_end(east)
|
52
|
+
end
|
53
|
+
def west!
|
54
|
+
dead_end(west)
|
55
|
+
end
|
56
|
+
end
|
data/lib/pie.rb
CHANGED
@@ -1,171 +1,52 @@
|
|
1
|
-
|
2
|
-
require 'player'
|
3
|
-
|
4
|
-
#puts "----------------- Ruby version = #{RUBY_VERSION}"
|
5
|
-
#raise ScriptError, "Pie requires Ruby 1.9 or higher" if RUBY_VERSION < "1.9.0"
|
6
|
-
NO_WAY_BACK = ""
|
7
|
-
class Pie
|
1
|
+
module Pie
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
attr_accessor :images
|
12
|
-
attr_accessor :default_template
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@default_template = :image_page
|
16
|
-
@places = Places.new
|
17
|
-
@map = Map.new(@places)
|
18
|
-
@images = {}
|
19
|
-
end
|
20
|
-
|
21
|
-
class WebApp < Sinatra::Base
|
22
|
-
set :root, File.join(File.expand_path(File.dirname(__FILE__)), "..")
|
23
|
-
|
24
|
-
get '/' do
|
25
|
-
"hello"
|
26
|
-
end
|
27
|
-
|
28
|
-
get '/:place_name' do
|
29
|
-
name = params[:place_name].to_sym
|
30
|
-
$current = name unless name.nil?
|
31
|
-
puts "current place name is #{$current}"
|
32
|
-
puts "current place is #{$pie.places[$current]}"
|
33
|
-
puts "--- skip out"; return if $pie.places[$current].nil?
|
34
|
-
puts "current links are #{$pie.places[$current].links.inspect}"
|
35
|
-
puts "displaying template: #{$pie.default_template.inspect}"
|
36
|
-
erb $pie.default_template
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
at_exit { WebApp.run! if !$0.include?("spec")}
|
41
|
-
|
42
|
-
class Map
|
43
|
-
|
44
|
-
def initialize places
|
45
|
-
@places = places
|
46
|
-
end
|
47
|
-
|
48
|
-
def path endpoints
|
49
|
-
puts "---> path #{endpoints.inspect}"
|
50
|
-
puts @places.inspect
|
51
|
-
#if h.size != 2
|
52
|
-
# return puts "path must have two and only two endpoints."
|
53
|
-
#end
|
54
|
-
start_place_key, end_place_key = endpoints.keys
|
55
|
-
label_for_end, label_for_start = endpoints.values
|
56
|
-
|
57
|
-
start_place = @places[start_place_key]
|
58
|
-
end_place = @places[end_place_key]
|
59
|
-
raise ArgumentError, "there is no place named '#{start_place_key}'" if start_place.nil?
|
60
|
-
raise ArgumentError, "there is no place named '#{end_place_key}'" if end_place.nil?
|
61
|
-
|
62
|
-
start_place[:links][end_place_key] = label_for_end unless label_for_end.empty?
|
63
|
-
end_place[:links][start_place_key] = label_for_start unless label_for_start.empty?
|
64
|
-
end
|
3
|
+
def self.[](key)
|
4
|
+
(@map ||= {})[key]
|
65
5
|
end
|
66
6
|
|
67
|
-
|
68
|
-
|
69
|
-
self[:links] = {}
|
70
|
-
end
|
71
|
-
def links
|
72
|
-
result = self[:links]
|
73
|
-
end
|
74
|
-
|
7
|
+
def self.[]=(key, value)
|
8
|
+
(@map ||= {})[key] = value
|
75
9
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
puts "making a #{name} with #{options.inspect}"
|
84
|
-
place = Place.new
|
85
|
-
place.merge! options
|
86
|
-
self[name.to_sym] = place
|
87
|
-
end
|
88
|
-
|
89
|
-
def [] string_or_symbol
|
90
|
-
super string_or_symbol.to_sym
|
91
|
-
end
|
92
|
-
|
93
|
-
def after(place_name)
|
94
|
-
index = keys.index(place_name.to_sym)
|
95
|
-
next_place_name = keys[index + 1]
|
96
|
-
self[next_place_name] unless next_place_name.nil?
|
97
|
-
end
|
98
|
-
|
99
|
-
def before(place_name)
|
100
|
-
index = keys.index(place_name.to_sym)
|
101
|
-
index = index - 1
|
102
|
-
if index < 0
|
103
|
-
nil
|
104
|
-
else
|
105
|
-
prev_place_name = keys[index]
|
106
|
-
self[prev_place_name]
|
107
|
-
end
|
10
|
+
|
11
|
+
def template(name = nil)
|
12
|
+
if name
|
13
|
+
Pie[:template] = name.to_sym
|
14
|
+
else
|
15
|
+
Pie[:template] || :image_page
|
108
16
|
end
|
109
17
|
end
|
110
|
-
|
111
|
-
def
|
112
|
-
|
113
|
-
@default_template = template_name.to_sym
|
114
|
-
end
|
115
|
-
|
116
|
-
def create_places(&block)
|
117
|
-
@places.instance_eval(&block)
|
118
|
-
end
|
119
|
-
|
120
|
-
def map(&block)
|
121
|
-
puts "-------- creating map --------"
|
122
|
-
@map.instance_eval(&block)
|
18
|
+
|
19
|
+
def images
|
20
|
+
Pie[:images] ||= {}
|
123
21
|
end
|
124
|
-
|
125
|
-
def image(
|
126
|
-
|
127
|
-
puts image_hash.inspect
|
128
|
-
@images.merge!(image_hash)
|
22
|
+
|
23
|
+
def image(image_maps)
|
24
|
+
images.merge!(image_maps)
|
129
25
|
end
|
130
26
|
|
131
|
-
def
|
132
|
-
|
27
|
+
def place(options)
|
28
|
+
Place.new(options)
|
133
29
|
end
|
134
|
-
|
135
|
-
def
|
136
|
-
|
30
|
+
|
31
|
+
def current_place(name=nil)
|
32
|
+
puts "current_place"
|
33
|
+
puts places.inspect
|
34
|
+
if name
|
35
|
+
Pie[:current_place] = places[name.to_sym]
|
36
|
+
else
|
37
|
+
Pie[:current_place]
|
38
|
+
end
|
137
39
|
end
|
138
40
|
|
139
|
-
|
140
|
-
|
141
|
-
puts $current.inspect
|
142
|
-
puts @images.inspect
|
143
|
-
@images[$current.to_sym]
|
41
|
+
def current_image
|
42
|
+
images[current_place.name] if current_place
|
144
43
|
end
|
145
|
-
|
146
|
-
def
|
147
|
-
|
148
|
-
puts $current.inspect
|
149
|
-
place = @places[$current.to_sym]
|
150
|
-
puts @place.inspect
|
151
|
-
place[:description] unless place.nil?
|
44
|
+
|
45
|
+
def places
|
46
|
+
Pie[:places] ||= {}
|
152
47
|
end
|
48
|
+
|
153
49
|
end
|
154
50
|
|
155
|
-
|
156
|
-
|
157
|
-
puts "-------------------------- making pie ---------------------------- "
|
158
|
-
$pie = Pie.new
|
159
|
-
$pie.instance_eval(&block)
|
160
|
-
puts "-------------------------- pie complete ---------------------------- "
|
161
|
-
end
|
162
|
-
|
163
|
-
def more_pie(&block)
|
164
|
-
puts "-------------------------- more pie ---------------------------- "
|
165
|
-
if $pie.nil?
|
166
|
-
puts "How can you make more pie when you haven't made any pie yet?"
|
167
|
-
return
|
168
|
-
end
|
169
|
-
$pie.instance_eval(&block)
|
170
|
-
puts "-------------------------- pie complete ---------------------------- "
|
171
|
-
end
|
51
|
+
require 'place'
|
52
|
+
require 'direction'
|
data/lib/pie.rb~
CHANGED
@@ -1,171 +1,50 @@
|
|
1
|
-
|
2
|
-
require 'player'
|
3
|
-
|
4
|
-
#puts "----------------- Ruby version = #{RUBY_VERSION}"
|
5
|
-
#raise ScriptError, "Pie requires Ruby 1.9 or higher" if RUBY_VERSION < "1.9.0"
|
6
|
-
NO_WAY_BACK = ""
|
7
|
-
class Pie
|
1
|
+
module Pie
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
attr_accessor :images
|
12
|
-
attr_accessor :default_template
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@default_template = :image_page
|
16
|
-
@places = Places.new
|
17
|
-
@map = Map.new(@places)
|
18
|
-
end
|
19
|
-
|
20
|
-
class WebApp < Sinatra::Base
|
21
|
-
set :root, File.join(File.expand_path(File.dirname(__FILE__)), "..")
|
22
|
-
|
23
|
-
get '/' do
|
24
|
-
"hello"
|
25
|
-
end
|
26
|
-
|
27
|
-
get '/:place_name' do
|
28
|
-
name = params[:place_name].to_sym
|
29
|
-
$current = name unless name.nil?
|
30
|
-
puts "current place name is #{$current}"
|
31
|
-
puts "current place is #{$pie.places[$current]}"
|
32
|
-
puts "--- skip out"; return if $pie.places[$current].nil?
|
33
|
-
puts "current links are #{$pie.places[$current].links.inspect}"
|
34
|
-
puts "displaying template: #{$pie.default_template.inspect}"
|
35
|
-
erb $pie.default_template
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
at_exit { WebApp.run! if !$0.include?("spec")}
|
40
|
-
|
41
|
-
class Map
|
42
|
-
|
43
|
-
def initialize places
|
44
|
-
@places = places
|
45
|
-
end
|
46
|
-
|
47
|
-
def path endpoints
|
48
|
-
puts "---> path #{endpoints.inspect}"
|
49
|
-
puts @places.inspect
|
50
|
-
#if h.size != 2
|
51
|
-
# return puts "path must have two and only two endpoints."
|
52
|
-
#end
|
53
|
-
start_place_key, end_place_key = endpoints.keys
|
54
|
-
label_for_end, label_for_start = endpoints.values
|
55
|
-
|
56
|
-
start_place = @places[start_place_key]
|
57
|
-
end_place = @places[end_place_key]
|
58
|
-
raise ArgumentError, "there is no place named '#{start_place_key}'" if start_place.nil?
|
59
|
-
raise ArgumentError, "there is no place named '#{end_place_key}'" if end_place.nil?
|
60
|
-
|
61
|
-
start_place[:links][end_place_key] = label_for_end unless label_for_end.empty?
|
62
|
-
end_place[:links][start_place_key] = label_for_start unless label_for_start.empty?
|
63
|
-
end
|
3
|
+
def self.[](key)
|
4
|
+
(@map ||= {})[key]
|
64
5
|
end
|
65
6
|
|
66
|
-
|
67
|
-
|
68
|
-
self[:links] = {}
|
69
|
-
end
|
70
|
-
def links
|
71
|
-
result = self[:links]
|
72
|
-
end
|
73
|
-
|
7
|
+
def self.[]=(key, value)
|
8
|
+
(@map ||= {})[key] = value
|
74
9
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
puts "making a #{name} with #{options.inspect}"
|
83
|
-
place = Place.new
|
84
|
-
place.merge! options
|
85
|
-
self[name.to_sym] = place
|
86
|
-
end
|
87
|
-
|
88
|
-
def [] string_or_symbol
|
89
|
-
super string_or_symbol.to_sym
|
90
|
-
end
|
91
|
-
|
92
|
-
def after(place_name)
|
93
|
-
index = keys.index(place_name.to_sym)
|
94
|
-
next_place_name = keys[index + 1]
|
95
|
-
self[next_place_name] unless next_place_name.nil?
|
96
|
-
end
|
97
|
-
|
98
|
-
def before(place_name)
|
99
|
-
index = keys.index(place_name.to_sym)
|
100
|
-
index = index - 1
|
101
|
-
if index < 0
|
102
|
-
nil
|
103
|
-
else
|
104
|
-
prev_place_name = keys[index]
|
105
|
-
self[prev_place_name]
|
106
|
-
end
|
10
|
+
|
11
|
+
def template(name = nil)
|
12
|
+
if name
|
13
|
+
Pie[:template] = name.to_sym
|
14
|
+
else
|
15
|
+
Pie[:template] || :image_page
|
107
16
|
end
|
108
17
|
end
|
109
|
-
|
110
|
-
def
|
111
|
-
|
112
|
-
@default_template = template_name.to_sym
|
113
|
-
end
|
114
|
-
|
115
|
-
def create_places(&block)
|
116
|
-
@places.instance_eval(&block)
|
117
|
-
end
|
118
|
-
|
119
|
-
def map(&block)
|
120
|
-
puts "-------- creating map --------"
|
121
|
-
@map.instance_eval(&block)
|
18
|
+
|
19
|
+
def images
|
20
|
+
Pie[:images] ||= {}
|
122
21
|
end
|
123
|
-
|
124
|
-
def image(
|
125
|
-
|
126
|
-
puts "--- set image"
|
127
|
-
puts image_hash.inspect
|
128
|
-
@images.merge!(image_hash)
|
22
|
+
|
23
|
+
def image(image_maps)
|
24
|
+
images.merge!(image_maps)
|
129
25
|
end
|
130
26
|
|
131
|
-
def
|
132
|
-
|
27
|
+
def place(options)
|
28
|
+
Place.new(options)
|
133
29
|
end
|
134
|
-
|
135
|
-
def
|
136
|
-
|
30
|
+
|
31
|
+
def current_place(name=nil)
|
32
|
+
if name
|
33
|
+
Pie[:current_place] = places[name.to_sym]
|
34
|
+
else
|
35
|
+
Pie[:current_place]
|
36
|
+
end
|
137
37
|
end
|
138
38
|
|
139
|
-
|
140
|
-
|
141
|
-
puts $current.inspect
|
142
|
-
puts @images.inspect
|
143
|
-
@images[$current.to_sym]
|
39
|
+
def current_image
|
40
|
+
images[current_place.name] if current_place
|
144
41
|
end
|
145
|
-
|
146
|
-
def
|
147
|
-
|
148
|
-
puts $current.inspect
|
149
|
-
place = @places[$current.to_sym]
|
150
|
-
puts @place.inspect
|
151
|
-
place[:description] unless place.nil?
|
42
|
+
|
43
|
+
def places
|
44
|
+
Pie[:places] ||= {}
|
152
45
|
end
|
46
|
+
|
153
47
|
end
|
154
48
|
|
155
|
-
|
156
|
-
|
157
|
-
puts "-------------------------- making pie ---------------------------- "
|
158
|
-
$pie = Pie.new
|
159
|
-
$pie.instance_eval(&block)
|
160
|
-
puts "-------------------------- pie complete ---------------------------- "
|
161
|
-
end
|
162
|
-
|
163
|
-
def more_pie(&block)
|
164
|
-
puts "-------------------------- more pie ---------------------------- "
|
165
|
-
if $pie.nil?
|
166
|
-
puts "How can you make more pie when you haven't made any pie yet?"
|
167
|
-
return
|
168
|
-
end
|
169
|
-
$pie.instance_eval(&block)
|
170
|
-
puts "-------------------------- pie complete ---------------------------- "
|
171
|
-
end
|
49
|
+
require 'place'
|
50
|
+
require 'direction'
|
data/lib/pie_server.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
class WebApp < Sinatra::Base
|
4
|
+
set :root, File.join(File.expand_path(File.dirname(__FILE__)), "..")
|
5
|
+
|
6
|
+
get '/' do
|
7
|
+
"hello"
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/:place_name' do
|
11
|
+
name = params[:place_name].to_sym
|
12
|
+
current_place(name) unless name.nil?
|
13
|
+
puts "current place name is #{current_place.name}"
|
14
|
+
puts "current place is #{current_place.description}"
|
15
|
+
puts "--- skip out"; return if current_place.nil?
|
16
|
+
puts "current links are #{current_place.paths.inspect}"
|
17
|
+
puts "displaying template: #{template.inspect}"
|
18
|
+
erb template
|
19
|
+
end
|
20
|
+
end
|
data/lib/pie_server.rb~
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
class WebApp < Sinatra::Base
|
4
|
+
set :root, File.join(File.expand_path(File.dirname(__FILE__)), "..")
|
5
|
+
|
6
|
+
get '/' do
|
7
|
+
"hello"
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/:place_name' do
|
11
|
+
name = params[:place_name].to_sym
|
12
|
+
puts "going to place with name #{name}"
|
13
|
+
current_place(name) unless name.nil?
|
14
|
+
puts "current place name is #{current_place.name}"
|
15
|
+
puts "current place is #{current_place.description}"
|
16
|
+
puts "--- skip out"; return if current_place.nil?
|
17
|
+
puts "current links are #{current_place.paths.inspect}"
|
18
|
+
puts "displaying template: #{template.inspect}"
|
19
|
+
erb template
|
20
|
+
end
|
21
|
+
end
|
data/lib/place.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
class Pie::Place
|
2
|
+
|
3
|
+
attr_reader :name, :description, :paths
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@paths = {}
|
7
|
+
extract_standard_options(options)
|
8
|
+
extract_name_and_description(options)
|
9
|
+
build_place_method
|
10
|
+
register_place
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
@name
|
15
|
+
end
|
16
|
+
|
17
|
+
def path(nodes)
|
18
|
+
nodes.each do |place_name, direction|
|
19
|
+
paths[place_name] = direction
|
20
|
+
places[place_name].paths[name] = direction.opposite unless direction.dead_end?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def extract_name_and_description(options)
|
27
|
+
raise "You seem to have extras option in this place!" unless options.length == 1
|
28
|
+
@name = options.keys.first
|
29
|
+
@description = options.values.first
|
30
|
+
end
|
31
|
+
|
32
|
+
def extract_standard_options(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_place_method
|
36
|
+
Pie.module_eval %{
|
37
|
+
def #{name}
|
38
|
+
places[:#{name}]
|
39
|
+
end
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def register_place
|
44
|
+
places[name] = self
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/views/game_screen.erb
CHANGED
@@ -52,13 +52,15 @@
|
|
52
52
|
|
53
53
|
<body>
|
54
54
|
<div id="background">
|
55
|
-
|
55
|
+
<% if current_image %>
|
56
|
+
<img src="<%= current_image %>" />
|
57
|
+
<% end %>
|
56
58
|
</div>
|
57
59
|
<div id="content">
|
58
|
-
<p><%=
|
60
|
+
<p><%= current_place.description %></p>
|
59
61
|
<p>
|
60
|
-
<%
|
61
|
-
<%= " <a href='#{place_name}'>#{label
|
62
|
+
<% current_place.paths.each do |place_name, label| %>
|
63
|
+
<%= " <a href='#{place_name}'>#{label}</a> " %>
|
62
64
|
<% end %>
|
63
65
|
</p>
|
64
66
|
</div>
|
metadata
CHANGED
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
|
9
|
-
version: 0.1.3
|
7
|
+
- 2
|
8
|
+
version: "0.2"
|
10
9
|
platform: ruby
|
11
10
|
authors:
|
12
11
|
- Sarah Allen, Sarah Mei
|
@@ -14,27 +13,30 @@ autorequire:
|
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
15
|
|
17
|
-
date: 2010-09-
|
16
|
+
date: 2010-09-19 00:00:00 -07:00
|
18
17
|
default_executable:
|
19
18
|
dependencies: []
|
20
19
|
|
21
20
|
description:
|
22
21
|
email:
|
23
|
-
executables:
|
24
|
-
|
22
|
+
executables:
|
23
|
+
- pie
|
25
24
|
extensions: []
|
26
25
|
|
27
26
|
extra_rdoc_files: []
|
28
27
|
|
29
28
|
files:
|
29
|
+
- lib/direction.rb
|
30
30
|
- lib/pie.rb
|
31
31
|
- lib/pie.rb~
|
32
|
-
- lib/
|
32
|
+
- lib/pie_server.rb
|
33
|
+
- lib/pie_server.rb~
|
34
|
+
- lib/place.rb
|
35
|
+
- bin/pie
|
36
|
+
- bin/pie~
|
33
37
|
- views/full_screen.erb
|
34
38
|
- views/game_screen.erb
|
35
|
-
- views/game_screen.erb~
|
36
39
|
- views/image_page.erb
|
37
|
-
- views/image_page.erb~
|
38
40
|
- README.md
|
39
41
|
- MIT-LICENSE.txt
|
40
42
|
has_rdoc: true
|
data/lib/player.rb
DELETED
data/views/game_screen.erb~
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
6
|
-
<title><%= $current %></title>
|
7
|
-
<style type="text/css" media="screen">
|
8
|
-
|
9
|
-
body {
|
10
|
-
background: #000;
|
11
|
-
}
|
12
|
-
|
13
|
-
div#background {
|
14
|
-
position: fixed;
|
15
|
-
top: 0;
|
16
|
-
left: 0;
|
17
|
-
width: 100%;
|
18
|
-
height: 100%
|
19
|
-
}
|
20
|
-
|
21
|
-
div#background img {
|
22
|
-
|
23
|
-
/* Set up proportionate scaling */
|
24
|
-
width: auto;
|
25
|
-
height: 100%;
|
26
|
-
|
27
|
-
/* Set up positioning */
|
28
|
-
margin-left: auto;
|
29
|
-
margin-right: auto;
|
30
|
-
display: block;
|
31
|
-
}
|
32
|
-
|
33
|
-
div#content {
|
34
|
-
/* This is the only important rule */
|
35
|
-
/* We need our content to show up on top of the background */
|
36
|
-
position: relative;
|
37
|
-
|
38
|
-
/* These have no effect on the functionality */
|
39
|
-
width: 80%;
|
40
|
-
margin: 0 auto;
|
41
|
-
background: #fff;
|
42
|
-
padding: 20px;
|
43
|
-
font-family: helvetica, arial, sans-serif;
|
44
|
-
font-size: 12pt;
|
45
|
-
line-height: 14pt;
|
46
|
-
-moz-box-shadow: #000 4px 4px 10px;
|
47
|
-
-webkit-box-shadow: #000 4px 4px 10px;
|
48
|
-
}
|
49
|
-
|
50
|
-
</style>
|
51
|
-
</head>
|
52
|
-
|
53
|
-
<body>
|
54
|
-
<div id="background">
|
55
|
-
<img src="<%= $pie.current_image %>" />
|
56
|
-
</div>
|
57
|
-
<div id="content">
|
58
|
-
<p><%= $pie.current_description %></p>
|
59
|
-
<p>
|
60
|
-
<% $pie.places[$current].links.each do |place_name, label| %>
|
61
|
-
<%= " <a href='#{place_name}'>#{label.to_s}</a> " %>
|
62
|
-
<% end %>
|
63
|
-
</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
|
67
|
-
</html>
|
data/views/image_page.erb~
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
6
|
-
<title><%= $current %></title>
|
7
|
-
<style type="text/css" media="screen">
|
8
|
-
|
9
|
-
|
10
|
-
img.bg {
|
11
|
-
/* Set rules to fill background */
|
12
|
-
min-height: 100%;
|
13
|
-
min-width: 1024px;
|
14
|
-
|
15
|
-
/* Set up proportionate scaling */
|
16
|
-
width: 100%;
|
17
|
-
height: auto;
|
18
|
-
|
19
|
-
/* Set up positioning */
|
20
|
-
position: fixed;
|
21
|
-
top: 0;
|
22
|
-
left: 0;
|
23
|
-
}
|
24
|
-
|
25
|
-
@media screen and (max-width: 1024px){
|
26
|
-
img.bg {
|
27
|
-
left: 50%;
|
28
|
-
margin-left: -512px; }
|
29
|
-
}
|
30
|
-
|
31
|
-
div#content {
|
32
|
-
/* This is the only important rule */
|
33
|
-
/* We need our content to show up on top of the background */
|
34
|
-
position: relative;
|
35
|
-
|
36
|
-
/* These have no effect on the functionality */
|
37
|
-
width: 100%;
|
38
|
-
margin: 0 auto;
|
39
|
-
padding: 20px;
|
40
|
-
font-family: helvetica, arial, sans-serif;
|
41
|
-
font-size: 32pt;
|
42
|
-
line-height: 40pt;
|
43
|
-
text-align: center;
|
44
|
-
text-shadow: 1px 1px #fff
|
45
|
-
}
|
46
|
-
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<img src="<%= $pie.current_image %>" class="bg" />
|
52
|
-
<div id="content">
|
53
|
-
<p><%= $pie.current_description %></p>
|
54
|
-
</div>
|
55
|
-
</body>
|
56
|
-
|
57
|
-
</html>
|