Skip to content
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
42 changes: 42 additions & 0 deletions Chris-Game/controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require_relative 'model'
require_relative 'view'

class DeafGrandmaController
include DeafGrandmaView

def run
Print::title

loop do
Print::main_menu
case Print::get_user_input
when"N"
play_game
when"T"
Print::tutorial
when "E"
Print::bye
exit
else
Print::error
end
end
end

def play_game
Print::game 'HOWDY SONNY!'
loop do
input = Print::get_user_input
if (input == 'BYE!') then
return
elsif (input != input.upcase) then
Print::game 'SPEAK UP SONNY!'
else
# Print a random message from the model.
Print::game DeafGrandmaModel::SENTENCES.sample.upcase
end
end
end
end

DeafGrandmaController.new.run
21 changes: 21 additions & 0 deletions Chris-Game/model.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class DeafGrandmaModel
SENTENCES = ["If the Easter Bunny and the Tooth Fairy had babies would they take your teeth and leave chocolate for you?",
"A purple pig and a green donkey flew a kite in the middle of the night and ended up sunburnt.",
"Last Friday in three week’s time I saw a spotted striped blue worm shake hands with a legless lizard.",
"Wednesday is hump day, but has anyone asked the camel if he’s happy about it?",
"If Purple People Eaters are real… where do they find purple people to eat?",
"A song can make or ruin a person’s day if they let it get to them.",
"Writing a list of random sentences is harder than I initially thought it would be.",
"Where do random thoughts come from?",
"Lets all be unique together until we realise we are all the same.",
"I will never be this young again. Ever. Oh damn… I just got older.",
"If I don’t like something, I’ll stay away from it.",
"I love eating toasted cheese and tuna sandwiches.",
"If you like tuna and tomato sauce- try combining the two. It’s really not as bad as it sounds.",
"When I was little I had a car door slammed shut on my hand. I still remember it quite vividly.",
"The clock within this blog and the clock on my laptop are hour different from each other.",
"I want to buy a onesie… but know it won’t suit me.",
"I currently have 4 windows open up… and I don’t know why.",
"I often see the time 11:11 or 12:34 on clocks.",
"This is the last random sentence I will be writing and I am going to stop mid-sent"].freeze
end
76 changes: 76 additions & 0 deletions Chris-Game/view.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module DeafGrandmaView

module Print

class << self
def title
content = <<TITLE

Welcome to Grandma Simulator 2017!
**********************************

TITLE
puts content
end
def main_menu
content = <<MENU
Please select an option:
N - New Game
T - Tutorial
E - Exit
MENU

puts content
end

def game input
grandma = <<GMA
.---.
(_---_)
(_/6 6\\_) #{input}
( v )
`\\o/'
GMA

puts grandma
end

def bye
goodbye = <<GOODBYE

**** SEE YA SONNY! ****

GOODBYE
puts goodbye
end

def error
error = <<ERROR

**** COME AGAIN SONNY?! ****

ERROR
puts error
end

def tutorial
tutorial = <<TUTORIAL

**** TUTORIAL ****
Welcome to grandma simulator 2017! Select 'N' to start a new
converstion with grandma, and she'll respond to what you say.

P.S. Grandma is a little hard of hearing in her old age, so
you have to speak up if you want to talk to her.

TUTORIAL

puts tutorial
end

def get_user_input
gets.chomp
end
end
end
end
Binary file added Jays-Game/.controller.rb.swp
Binary file not shown.
Binary file added Jays-Game/.model.rb.swp
Binary file not shown.
Binary file added Jays-Game/.view.rb.swp
Binary file not shown.