catgame 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/bin/catgame +8 -0
- data/lib/autoload.rb +20 -0
- data/lib/catgame.rb +15 -0
- data/lib/catgame/version.rb +3 -0
- data/lib/helper/assets.rb +192 -0
- data/lib/helper/death_helper.rb +8 -0
- data/lib/helper/markup_helper.rb +15 -0
- data/lib/levels/death.rb +20 -0
- data/lib/levels/feeding_room.rb +70 -0
- data/lib/levels/first_room.rb +63 -0
- data/lib/levels/guest_room.rb +74 -0
- data/lib/levels/happy_end.rb +75 -0
- data/lib/levels/sleeping_room.rb +89 -0
- data/lib/levels/styling_room.rb +73 -0
- data/lib/levels/training_room.rb +85 -0
- data/lib/levels/washing_room.rb +76 -0
- data/test/test_catgame.rb +16 -0
- metadata +85 -0
data/.gitignore
ADDED
data/bin/catgame
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$APP_ROOT = File.dirname(__FILE__) + "/../"
|
4
|
+
|
5
|
+
require $APP_ROOT + "lib/autoload" # Anstatt require "../lib/autoload" mit dem __FILE__ legt man die Ausganslage definitv fest. egal von wo man auf die Datei zugreift. (ROOT-Verzichnis abosul angeben)
|
6
|
+
|
7
|
+
a = Catgame.new(Levels::FirstRoom)
|
8
|
+
a.play
|
data/lib/autoload.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Helper
|
2
|
+
autoload :MarkupHelper, $APP_ROOT + 'lib/helper/markup_helper'
|
3
|
+
autoload :DeathHelper, $APP_ROOT + 'lib/helper/death_helper'
|
4
|
+
autoload :Assets, $APP_ROOT + 'lib/helper/assets.rb'
|
5
|
+
end
|
6
|
+
|
7
|
+
module Levels
|
8
|
+
autoload :FirstRoom, $APP_ROOT + 'lib/levels/first_room'
|
9
|
+
autoload :FeedingRoom, $APP_ROOT + 'lib/levels/feeding_room'
|
10
|
+
autoload :WashingRoom, $APP_ROOT + 'lib/levels/washing_room'
|
11
|
+
autoload :TrainingRoom, $APP_ROOT + 'lib/levels/training_room'
|
12
|
+
autoload :StylingRoom, $APP_ROOT + 'lib/levels/styling_room'
|
13
|
+
autoload :GuestRoom, $APP_ROOT + 'lib/levels/guest_room'
|
14
|
+
autoload :SleepingRoom, $APP_ROOT + 'lib/levels/sleeping_room'
|
15
|
+
autoload :HappyEnd, $APP_ROOT + 'lib/levels/happy_end'
|
16
|
+
autoload :Assets, $APP_ROOT + 'lib/levels/assets'
|
17
|
+
autoload :Death, $APP_ROOT + 'lib/levels/death'
|
18
|
+
end
|
19
|
+
|
20
|
+
autoload :Catgame, $APP_ROOT + 'lib/catgame.rb'
|
data/lib/catgame.rb
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
module Helper
|
2
|
+
module Assets
|
3
|
+
def self.cat
|
4
|
+
<<-CAT
|
5
|
+
/\\__/\\
|
6
|
+
/` '\\
|
7
|
+
=== 0 0 ===
|
8
|
+
\\ -- /
|
9
|
+
/ \\
|
10
|
+
/ \\
|
11
|
+
| |
|
12
|
+
\\ || || /
|
13
|
+
\\_oo__oo_/#######o
|
14
|
+
|
15
|
+
CAT
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.kuss
|
19
|
+
<<-KUSS
|
20
|
+
## #####
|
21
|
+
## #########+####
|
22
|
+
# ## # ## ##########+++++++x###
|
23
|
+
## ## ########## ##### ##+++####+++###
|
24
|
+
## ### #++++##### #++## ##++## ##+++####
|
25
|
+
####### #########+++++++####++# #++### ##++### # #########
|
26
|
+
x##########X#++++######+++++++++## ##++## ##+++# ## -# ############# #
|
27
|
+
#####+++## #++++++######++++++x## ##+## ######### ###########x###+++++#####
|
28
|
+
## ## ##+++###++++++## ##++++x## ##x### ######## # #######+++++#####++++++###
|
29
|
+
##### ##++++++++++++X### ######## ##### ## ## ## ###++++++++### ##++++++++###
|
30
|
+
# #####++++++++++X## ### ### #### ## # #######+++++++#### ###+++++++++###
|
31
|
+
################ # ## ### # ####+++++++++++### ####++++++++++####
|
32
|
+
### #####+++++++++++++## ## +#++++++++++++###
|
33
|
+
####### ## # #####+###X++++###### ### ##x####++++++++####
|
34
|
+
###### ################ # ########+### ## ### ##### #++++++++++####
|
35
|
+
#### ##++++########## # ### ##### ### ## ##### ###++++++++++++####
|
36
|
+
## ####++++# #### #### ## ### # ## #### ###++++++++++++++####
|
37
|
+
## ###+++++++### # ############ ### #####++++++++++++++++###
|
38
|
+
# ##+++++++++### # ######## # #######+++++++++++++++++####
|
39
|
+
#+++++++#### # ### ###### # #############+x###### #
|
40
|
+
####++++++### # # ### ## ####### ## #### ##### ##
|
41
|
+
########### #### ### ####### ####### # # ############# #######
|
42
|
+
### #### ##### # #### ## ################### ###### #+# ############
|
43
|
+
# # ###### ## ### # ## ###### ### ############ # ####### ##- ###
|
44
|
+
#### ##### ###### ## # ## # # #### # ### # ###### #####+#
|
45
|
+
## #### ####### ##### ## # ### # -##
|
46
|
+
# # ## ##+### ###+######### #### # # # # ### ### ##
|
47
|
+
## ## ##+### ###++++++#### ###### ## ## ####### ## ## #### ###### #
|
48
|
+
# ##### ###X+++++++### ###+####### ####### ## ### ## ############ #######
|
49
|
+
####### ###+++++++++# =##+++++++#####++++# ## ################## ### ##
|
50
|
+
### ######XX####++########++++++++++++++#### ### ## # # -## ##
|
51
|
+
## ####### ## #++++### #+++++++++++++#### #### ### ## # ## #####
|
52
|
+
#### #### ##++++## ###+++++++++++x### ## # # ## # ## #
|
53
|
+
##### ###################### +++##### ########### #
|
54
|
+
# ########## ## ### ###### # ### ##
|
55
|
+
### ### #### ##X### # # #
|
56
|
+
KUSS
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.guest
|
60
|
+
<<-BY_GUEST
|
61
|
+
* ,MMM8&&&. *
|
62
|
+
MMMM88&&&&& .
|
63
|
+
MMMM88&&&&&&&
|
64
|
+
* MMM88&&&&&&&&
|
65
|
+
MMM88&&&&&&&&
|
66
|
+
'MMM88&&&&&&'
|
67
|
+
'MMM8&&&' *
|
68
|
+
/\\/|_ __/\\\\
|
69
|
+
/ -\\ /- ~\\ . '
|
70
|
+
\ = Y =T_ = /
|
71
|
+
)==*(` `) ~ \\
|
72
|
+
/ \\ / \\
|
73
|
+
| | ) ~ (
|
74
|
+
/ \\ / ~ \\
|
75
|
+
\\ / \\~ ~/
|
76
|
+
_/\\_/\\_/\\__ _/_/\\_/\\__~__/_/\\_/\\_/\\_/\\_/\\_
|
77
|
+
| | | | ) ) | | | (( | | | | | |
|
78
|
+
| | | |( ( | | | \\\\ | | | | | |
|
79
|
+
| | | | )_) | | | |))| | | | | |
|
80
|
+
| | | | | | | | (/ | | | | | |
|
81
|
+
| | | | | | | | | | | | | | |
|
82
|
+
BY_GUEST
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.sleeping
|
86
|
+
<<-SLEEPING
|
87
|
+
* *
|
88
|
+
__ *
|
89
|
+
,db' * *
|
90
|
+
,d8/ * * *
|
91
|
+
888
|
92
|
+
`db\ * *
|
93
|
+
`o`_ **
|
94
|
+
* * * _ *
|
95
|
+
* / )
|
96
|
+
* (\\__/) * ( ( *
|
97
|
+
,-.,-.,) (.,-.,-.,-.) ).,-.,-.
|
98
|
+
| @| ={ }= | @| / / | @|o |
|
99
|
+
_j__j__j_) `-------/ /__j__j__j_
|
100
|
+
________( /___________
|
101
|
+
| | @| \\ || o|O | @|
|
102
|
+
|o | |,'\\ , ,'"| | | |
|
103
|
+
vV\\|/vV|`-'\\ ,---\\ | \\Vv\\hjwVv\\//v
|
104
|
+
_) ) `. \\ /
|
105
|
+
(__/ ) )
|
106
|
+
(_/
|
107
|
+
SLEEPING
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.styling
|
111
|
+
<<-STYLING
|
112
|
+
/\\ /\\
|
113
|
+
{ `---' }
|
114
|
+
{ O O }
|
115
|
+
~~|~ V ~|~~
|
116
|
+
\\ \\|/ /
|
117
|
+
`-----'__
|
118
|
+
/ \\ `^\\_
|
119
|
+
{ }\\ |\\_\\_ _
|
120
|
+
| \\_/ |/ / \\_\\_( )
|
121
|
+
\\__/ /(_/ \\__/
|
122
|
+
(__/
|
123
|
+
|
124
|
+
STYLING
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.training
|
128
|
+
<<-TRAINING
|
129
|
+
,. ,.
|
130
|
+
{^ \\-"-/ ^}
|
131
|
+
" """ "
|
132
|
+
{ <O> _ <O> }
|
133
|
+
==_ .:Y:. _==
|
134
|
+
."" `--^--' "".
|
135
|
+
(,~-~."" "" ,~-~.)
|
136
|
+
------( )----( )-----
|
137
|
+
^-'-'-^ ^-'-'-^
|
138
|
+
_____________________________
|
139
|
+
|"""" /~.^.~\\ """"|
|
140
|
+
,i-i-i(""( i-i-i.
|
141
|
+
(o o o ))"")( o o o)
|
142
|
+
\\(_) /(""( \\ (_)/
|
143
|
+
`--' \\""\\ `--'
|
144
|
+
)"")
|
145
|
+
(""/
|
146
|
+
TRAINING
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.washing
|
150
|
+
<<-WASHING
|
151
|
+
.-------.
|
152
|
+
/ `----.___
|
153
|
+
J ` __ /|
|
154
|
+
/| / |\\/`--' (
|
155
|
+
.' \\ | | | _ _ \\
|
156
|
+
.-' .' \\ | \\ _ ` `_ )
|
157
|
+
-' .-' | ) \\ `. \\.' `. _X/
|
158
|
+
.-' | ( \\ `````` \\ \\ \\| `-._.-'
|
159
|
+
| | |`. \\ \\ | \\ \\ \\ \\ | | |
|
160
|
+
|| `. `._`._ \\ \\_ \\ `_
|
161
|
+
| | | `.__)__) | `._) `._) |
|
162
|
+
|
163
|
+
WASHING
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.feeding
|
167
|
+
<<-EATING
|
168
|
+
)\\._.,--....,'``.
|
169
|
+
.b--. /; _.. \\ _\\ (`._ ,.
|
170
|
+
`=,-,-'~~~ `----(,_..'--(,_..'`-.;.'
|
171
|
+
EATING
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.deathpic
|
175
|
+
<<-DEATH
|
176
|
+
___
|
177
|
+
,_ '---' _,
|
178
|
+
\\ `-._|\\_/|_.-' /
|
179
|
+
| =)'T'(= |
|
180
|
+
\\ /`"`\\ /
|
181
|
+
'._\\) (/_.'
|
182
|
+
| |
|
183
|
+
/\\ /\\
|
184
|
+
\\ T /
|
185
|
+
(/ \\)\\
|
186
|
+
))
|
187
|
+
((
|
188
|
+
\\)
|
189
|
+
DEATH
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Helper
|
2
|
+
module MarkupHelper
|
3
|
+
def space
|
4
|
+
puts "\n------------------------------------------------------------------------------------\n\n"
|
5
|
+
end
|
6
|
+
|
7
|
+
def prompt
|
8
|
+
print "\n[ YOUR INPUT ]> "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pause
|
12
|
+
sleep 2
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/levels/death.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Levels
|
2
|
+
class Death
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@status = Helper::Assets.deathpic
|
7
|
+
end
|
8
|
+
|
9
|
+
def death
|
10
|
+
space
|
11
|
+
puts <<-PARAGRAPH
|
12
|
+
*** R.I.P Johnny ***
|
13
|
+
|
14
|
+
PARAGRAPH
|
15
|
+
puts @status
|
16
|
+
space
|
17
|
+
Process.exit(0)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Levels
|
2
|
+
class FeedingRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "mouse"
|
7
|
+
BAD_CHOICE = "cat food"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.feeding
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
choice_explain
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp
|
18
|
+
case action
|
19
|
+
when GOOD_CHOICE
|
20
|
+
first_choice
|
21
|
+
return Levels::WashingRoom
|
22
|
+
when BAD_CHOICE
|
23
|
+
second_choice
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def choice_explain
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
Ok, It is morning and Johnny is hungry. He needs some food.
|
34
|
+
My grandmother gave you some special cat food.
|
35
|
+
But it seems that Johnny prefers to eat a mouse.
|
36
|
+
What do you do?
|
37
|
+
Do you give Johnny the special food from my Grandmother? Then type "#{BAD_CHOICE}".
|
38
|
+
Or do you let Johny hunt a wild mouse? Then type "#{GOOD_CHOICE}".
|
39
|
+
PARAGRAPH
|
40
|
+
end
|
41
|
+
|
42
|
+
def first_choice
|
43
|
+
space
|
44
|
+
puts <<-PARAGRAPH
|
45
|
+
Oh, nice decicion. Johnny loves to hunt mouses.
|
46
|
+
|
47
|
+
PARAGRAPH
|
48
|
+
puts @status
|
49
|
+
space
|
50
|
+
pause
|
51
|
+
end
|
52
|
+
|
53
|
+
def second_choice
|
54
|
+
space
|
55
|
+
puts <<-PARAGRAPH
|
56
|
+
Oh man, the food from my grandmother wasn't fresh anymore
|
57
|
+
That's maybe the reason why Johnny don't move anymore.
|
58
|
+
PARAGRAPH
|
59
|
+
death
|
60
|
+
end
|
61
|
+
|
62
|
+
def invalid_input
|
63
|
+
space
|
64
|
+
puts <<-PARAGRAPH
|
65
|
+
"#{GOOD_CHOICE}" or "#{BAD_CHOICE}" what is so difficult???
|
66
|
+
Try it again:
|
67
|
+
PARAGRAPH
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Levels
|
2
|
+
class FirstRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "Hello lovely Johnny"
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@state = Helper::Assets.cat
|
10
|
+
end
|
11
|
+
|
12
|
+
def enter
|
13
|
+
explain_choices
|
14
|
+
loop do
|
15
|
+
prompt
|
16
|
+
action = gets.chomp
|
17
|
+
case action
|
18
|
+
when GOOD_CHOICE
|
19
|
+
first_choice
|
20
|
+
return Levels::FeedingRoom
|
21
|
+
else
|
22
|
+
invalid_input
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def explain_choices
|
29
|
+
space
|
30
|
+
puts "**** WELCOME ****"
|
31
|
+
puts "Let me introduce you to the cat of my grandmother:"
|
32
|
+
space
|
33
|
+
puts @state
|
34
|
+
space
|
35
|
+
puts <<-PARAGRAPH
|
36
|
+
It is a "he" and it\'s name is "Johnny".
|
37
|
+
Johnny is the one and only for my grandmother. Today you are the nanny for Johnny.
|
38
|
+
The only thing you have to do is bringing Johnny healthy back to my grandmother.
|
39
|
+
If you are allergic against cats then press "Ctrl + C" to end.
|
40
|
+
If you are ready for a day with lovely Johnny type: "#{GOOD_CHOICE}".
|
41
|
+
PARAGRAPH
|
42
|
+
end
|
43
|
+
|
44
|
+
def first_choice
|
45
|
+
space
|
46
|
+
puts <<-PARAGRAPH
|
47
|
+
Well, i like your decicion.
|
48
|
+
let us go on.
|
49
|
+
PARAGRAPH
|
50
|
+
space
|
51
|
+
pause
|
52
|
+
end
|
53
|
+
|
54
|
+
def invalid_input
|
55
|
+
space
|
56
|
+
puts <<-PARAGRAPH
|
57
|
+
I dont understand you.
|
58
|
+
Try it again. Good luck!
|
59
|
+
PARAGRAPH
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Levels
|
2
|
+
class GuestRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "allow"
|
7
|
+
BAD_CHOICE = "forbid"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.guest
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
explain_choices
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp
|
18
|
+
case action
|
19
|
+
when GOOD_CHOICE
|
20
|
+
first_choice
|
21
|
+
return Levels::SleepingRoom
|
22
|
+
when BAD_CHOICE
|
23
|
+
second_choice
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def explain_choices
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
Well, you are pointly arrived by your Friend.
|
34
|
+
You go in and have a duff beer with your Friend.
|
35
|
+
Johnny sneaking around your feets and makes some noices
|
36
|
+
like: "MIIIIAAAAUUUUUW".
|
37
|
+
Johnny is bored and wants to go outside playing.
|
38
|
+
Do you allow Johnny to go outside? Then type "#{GOOD_CHOICE}".
|
39
|
+
Or do you want to have Johnny by your side beacause of the
|
40
|
+
dangers which are outside? Then type "#{BAD_CHOICE}".
|
41
|
+
PARAGRAPH
|
42
|
+
end
|
43
|
+
|
44
|
+
def first_choice
|
45
|
+
space
|
46
|
+
puts <<-PARAGRAPH
|
47
|
+
So you let Johnny go outside for playing.
|
48
|
+
After a while you would like to go home and
|
49
|
+
search Johnny outside. You found Johnny on a fence
|
50
|
+
with a nice cat-ladejh.
|
51
|
+
|
52
|
+
PARAGRAPH
|
53
|
+
puts @status
|
54
|
+
space
|
55
|
+
pause
|
56
|
+
end
|
57
|
+
|
58
|
+
def second_choice
|
59
|
+
space
|
60
|
+
puts <<-PARAGRAPH
|
61
|
+
Poor Johnny. He was so bored, that he can't breath anymore.
|
62
|
+
Johnny never plays outside again.
|
63
|
+
PARAGRAPH
|
64
|
+
death
|
65
|
+
end
|
66
|
+
|
67
|
+
def invalid_input
|
68
|
+
space
|
69
|
+
puts <<-PARAGRAPH
|
70
|
+
Johnny didn't understand you. Can you repeat your answer?
|
71
|
+
PARAGRAPH
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Levels
|
2
|
+
class HappyEnd
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "bye lovely Johnny"
|
7
|
+
BAD_CHOICE = "flee"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.kuss
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
explain_choices
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp
|
18
|
+
case action
|
19
|
+
when GOOD_CHOICE
|
20
|
+
first_choice
|
21
|
+
Process.exit(0)
|
22
|
+
when BAD_CHOICE
|
23
|
+
second_choice
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def explain_choices
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
It's morning and you have to bring Johnny back home.
|
34
|
+
You had a lot of fun with Johnny and you're really sad to
|
35
|
+
give him back home.
|
36
|
+
Now you have the following Choices:
|
37
|
+
You can kidnap Johnny, leave the country and beginn a new live.
|
38
|
+
When this is what you want type "#{BAD_CHOICE}".
|
39
|
+
Or you can be a nice Peson and bring johnny back to my
|
40
|
+
grandmother.
|
41
|
+
When this is what you want type "#{GOOD_CHOICE}"
|
42
|
+
PARAGRAPH
|
43
|
+
end
|
44
|
+
|
45
|
+
def first_choice
|
46
|
+
space
|
47
|
+
puts <<-PARAGRAPH
|
48
|
+
My Grandmother is verry happy to see Johnny again.
|
49
|
+
She gives you a biiiig kiss:
|
50
|
+
|
51
|
+
PARAGRAPH
|
52
|
+
puts @status
|
53
|
+
puts "\nWell done!"
|
54
|
+
space
|
55
|
+
pause
|
56
|
+
end
|
57
|
+
|
58
|
+
def second_choice
|
59
|
+
space
|
60
|
+
puts <<-PARAGRAPH
|
61
|
+
You take with Johnny the next flight to Columbia.
|
62
|
+
Johnny's heartache was big because he still miss his girlfriend.
|
63
|
+
He's heart decided to don't beat anmymore.
|
64
|
+
PARAGRAPH
|
65
|
+
death
|
66
|
+
end
|
67
|
+
def invalid_input
|
68
|
+
space
|
69
|
+
puts <<-PARAGRAPH
|
70
|
+
I know it is a hard decision but you have to make
|
71
|
+
a choise between "flee" or "bye lovely Johnny".
|
72
|
+
PARAGRAPH
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Levels
|
2
|
+
class SleepingRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "yes"
|
7
|
+
BAD_CHOICE = "no"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.sleeping
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
explain_choices
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp
|
18
|
+
case action
|
19
|
+
when GOOD_CHOICE
|
20
|
+
first_choice
|
21
|
+
return Levels::HappyEnd
|
22
|
+
when BAD_CHOICE
|
23
|
+
second_choice
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def explain_choices
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
After Johnny said good bye to his new girlfriend.
|
34
|
+
You and Johnny went home. It was late now.
|
35
|
+
Johnny's heart is broken because he misses his new girfriend.
|
36
|
+
Because of that Johnny would like to sleep outside.
|
37
|
+
Do you allow Johnny to sleep outside? Then type "#{GOOD_CHOICE}".
|
38
|
+
Do you don't allow Johnny to sleep outside? Then type "#{BAD_CHOICE}".
|
39
|
+
PARAGRAPH
|
40
|
+
end
|
41
|
+
|
42
|
+
def first_choice
|
43
|
+
space
|
44
|
+
puts <<-PARAGRAPH
|
45
|
+
Johnny is outside but he can't sleep.
|
46
|
+
He's starring at the moon and thinking about he's new
|
47
|
+
girlfriend.
|
48
|
+
|
49
|
+
PARAGRAPH
|
50
|
+
puts @status
|
51
|
+
puts <<-PARAGRAPH
|
52
|
+
|
53
|
+
He said to himself "I know she's too starring at te moon and misses me."
|
54
|
+
And with this mind he sleeps good this night.
|
55
|
+
PARAGRAPH
|
56
|
+
space
|
57
|
+
pause
|
58
|
+
end
|
59
|
+
|
60
|
+
def second_choice
|
61
|
+
space
|
62
|
+
puts <<-PARAGRAPH
|
63
|
+
This was the last night for Johnny.
|
64
|
+
He's heart hurt so much that Johnny decied
|
65
|
+
to never wake up again.
|
66
|
+
PARAGRAPH
|
67
|
+
death
|
68
|
+
end
|
69
|
+
|
70
|
+
def invalid_input
|
71
|
+
space
|
72
|
+
puts <<-PARAGRAPH
|
73
|
+
|
74
|
+
Please make a decision between
|
75
|
+
"yes" or "no".
|
76
|
+
|
77
|
+
If you choose "yes" please push on your keyboard:
|
78
|
+
"Y" then "E" then "S" and finally "ENTER"
|
79
|
+
|
80
|
+
If you choose "no" please push on your keyboard:
|
81
|
+
"N" then "O" (That's not a number!) and finally "ENTER"
|
82
|
+
|
83
|
+
If you're not able to make that. Please push on your keyboard:
|
84
|
+
"Ctrl" + "C"
|
85
|
+
After that go out and play in the sandpit. Have fun!
|
86
|
+
PARAGRAPH
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Levels
|
2
|
+
class StylingRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "dry"
|
7
|
+
BAD_CHOICE = "wet"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.styling
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
explain_choices
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp
|
18
|
+
case action
|
19
|
+
when GOOD_CHOICE
|
20
|
+
first_choice
|
21
|
+
return Levels::GuestRoom
|
22
|
+
when BAD_CHOICE
|
23
|
+
second_choice
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def explain_choices
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
After the Training, Johnny doesn't look very nice.
|
34
|
+
You would like to visit some friends. And because of that
|
35
|
+
you have to pimp up Johnny for the visit.
|
36
|
+
You wash Johnny again.
|
37
|
+
Now it's two o'clock in the afternoon and you have to hurry up.
|
38
|
+
Johnny is still wet. So what do you gonna do?
|
39
|
+
Do you go out with Johnny while he is still wet? Then type "#{BAD_CHOICE}".
|
40
|
+
Or do you blow Johhny dry with the hairdryer? Then type "#{GOOD_CHOICE}".
|
41
|
+
PARAGRAPH
|
42
|
+
end
|
43
|
+
|
44
|
+
def first_choice
|
45
|
+
space
|
46
|
+
puts <<-PARAGRAPH
|
47
|
+
Well done, Johnny looks sooooouuuw sweeet <3 <3
|
48
|
+
Doesn't he?
|
49
|
+
|
50
|
+
PARAGRAPH
|
51
|
+
puts @status
|
52
|
+
space
|
53
|
+
pause
|
54
|
+
end
|
55
|
+
|
56
|
+
def second_choice
|
57
|
+
space
|
58
|
+
puts <<-PARAGRAPH
|
59
|
+
Oh, no ! It was too cold for Johnny outside.
|
60
|
+
He is frozen and never mets your Friend.
|
61
|
+
PARAGRAPH
|
62
|
+
death
|
63
|
+
end
|
64
|
+
|
65
|
+
def invalid_input
|
66
|
+
space
|
67
|
+
puts <<-PARAGRAPH
|
68
|
+
The fucking question was "dry" or "wet" so type "dry" or "wet" and nothing other !!!
|
69
|
+
Remember you have to hurry up !!!
|
70
|
+
PARAGRAPH
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Levels
|
2
|
+
class TrainingRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = 5
|
7
|
+
BAD_CHOICE = 10
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.training
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
explain_choices
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp.to_i
|
18
|
+
case action
|
19
|
+
when 5
|
20
|
+
first_choice(1)
|
21
|
+
return Levels::StylingRoom
|
22
|
+
when 10
|
23
|
+
second_choice(1)
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def explain_choices
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
Johnny needs hard training to stay fit. So it's time to
|
34
|
+
do something.
|
35
|
+
You go with Johnny to a training hall, where other lovely cats
|
36
|
+
also do their training.
|
37
|
+
Now it's your turn to say Johnny how much he has to work.
|
38
|
+
Type "5" if you want Johnny to take a easy training.
|
39
|
+
Or Type "10" if you want Johnny to take a hard training.
|
40
|
+
PARAGRAPH
|
41
|
+
end
|
42
|
+
|
43
|
+
def first_choice(i)
|
44
|
+
numbers = []
|
45
|
+
while i <= 5
|
46
|
+
puts "Training ##{i}"
|
47
|
+
puts @status
|
48
|
+
sleep 1
|
49
|
+
numbers.push(i)
|
50
|
+
i = i + 1
|
51
|
+
end
|
52
|
+
space
|
53
|
+
puts "Well Done ! You can be proud about Johnny\n"
|
54
|
+
space
|
55
|
+
pause
|
56
|
+
end
|
57
|
+
|
58
|
+
def second_choice(i)
|
59
|
+
numbers = []
|
60
|
+
while i <= 10
|
61
|
+
puts "Training ##{i}"
|
62
|
+
sleep 1
|
63
|
+
puts @status
|
64
|
+
numbers.push(i)
|
65
|
+
i = i + 1
|
66
|
+
break if i == 6
|
67
|
+
end
|
68
|
+
training_interrupt(i)
|
69
|
+
end
|
70
|
+
|
71
|
+
def invalid_input
|
72
|
+
space
|
73
|
+
puts "Try to type 5 or 10. I believe in you, you get it!"
|
74
|
+
end
|
75
|
+
|
76
|
+
def training_interrupt(i)
|
77
|
+
space
|
78
|
+
puts <<-PARAGRAPH
|
79
|
+
Shit happens. That was too much for Johnny.
|
80
|
+
Johnny never made a ##{i} Training."
|
81
|
+
PARAGRAPH
|
82
|
+
death
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Levels
|
2
|
+
class WashingRoom
|
3
|
+
include Helper::MarkupHelper
|
4
|
+
include Helper::DeathHelper
|
5
|
+
|
6
|
+
GOOD_CHOICE = "pullover"
|
7
|
+
BAD_CHOICE = "birdhouse"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@status = Helper::Assets.washing
|
11
|
+
end
|
12
|
+
|
13
|
+
def enter
|
14
|
+
explain_choices
|
15
|
+
loop do
|
16
|
+
prompt
|
17
|
+
action = gets.chomp
|
18
|
+
case action
|
19
|
+
when GOOD_CHOICE
|
20
|
+
fist_choice
|
21
|
+
return Levels::TrainingRoom
|
22
|
+
when BAD_CHOICE
|
23
|
+
second_choice
|
24
|
+
else
|
25
|
+
invalid_input
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def explain_choices
|
32
|
+
puts <<-PARAGRAPH
|
33
|
+
Well, after the hard hunting Johnny is very dirty now.
|
34
|
+
He needs a bath. So you go to the bathroom and fill the bath tube with
|
35
|
+
Water. Now you have to wait until the tube is full.
|
36
|
+
What do you do while you are waiting?
|
37
|
+
Do you build a birdhouse for the garden? Then type "#{BAD_CHOICE}".
|
38
|
+
Or do you knit up a lovely pullover for your friend? Then type "#{GOOD_CHOICE}".
|
39
|
+
PARAGRAPH
|
40
|
+
end
|
41
|
+
|
42
|
+
def fist_choice
|
43
|
+
space
|
44
|
+
puts <<-PARAGRAPH
|
45
|
+
Oh, Johnny loves wool. While you are knitting up the pullover,
|
46
|
+
Johnny plays with the wool.
|
47
|
+
And as soon as the bath tube was full you cleaned up Johhny.
|
48
|
+
|
49
|
+
He looks gorgeous, dosen't he?
|
50
|
+
|
51
|
+
PARAGRAPH
|
52
|
+
puts @status
|
53
|
+
space
|
54
|
+
pause
|
55
|
+
end
|
56
|
+
|
57
|
+
def second_choice
|
58
|
+
space
|
59
|
+
puts <<-PARAGRAPH
|
60
|
+
While you are building your birdhouse in the garden,
|
61
|
+
Johnny plays lonely in your flat.
|
62
|
+
After you came back from building the birhouse,
|
63
|
+
you find Johnny in the bath tube.
|
64
|
+
The tube was too full for Johnny.
|
65
|
+
PARAGRAPH
|
66
|
+
death
|
67
|
+
end
|
68
|
+
|
69
|
+
def invalid_input
|
70
|
+
space
|
71
|
+
puts <<-PARAGRAPH
|
72
|
+
Please make a decicion between "#{BAD_CHOICE}" and "#{BAD_CHOICE}".
|
73
|
+
PARAGRAPH
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: catgame
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Franca Rast
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-09-02 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: "Play a game with a lovely cat in the terminal. "
|
23
|
+
email:
|
24
|
+
- franca.rast@screenconcept.ch
|
25
|
+
executables:
|
26
|
+
- catgame
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- bin/catgame
|
34
|
+
- lib/autoload.rb
|
35
|
+
- lib/catgame.rb
|
36
|
+
- lib/catgame/version.rb
|
37
|
+
- lib/helper/assets.rb
|
38
|
+
- lib/helper/death_helper.rb
|
39
|
+
- lib/helper/markup_helper.rb
|
40
|
+
- lib/levels/death.rb
|
41
|
+
- lib/levels/feeding_room.rb
|
42
|
+
- lib/levels/first_room.rb
|
43
|
+
- lib/levels/guest_room.rb
|
44
|
+
- lib/levels/happy_end.rb
|
45
|
+
- lib/levels/sleeping_room.rb
|
46
|
+
- lib/levels/styling_room.rb
|
47
|
+
- lib/levels/training_room.rb
|
48
|
+
- lib/levels/washing_room.rb
|
49
|
+
- test/test_catgame.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: https://github.com/ryabrody
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project: catgame
|
80
|
+
rubygems_version: 1.3.7
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Fancy game for Cat-Fans
|
84
|
+
test_files:
|
85
|
+
- test/test_catgame.rb
|