diff --git a/Chris-Game/controller.rb b/Chris-Game/controller.rb new file mode 100644 index 0000000..18c0700 --- /dev/null +++ b/Chris-Game/controller.rb @@ -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 diff --git a/Chris-Game/model.rb b/Chris-Game/model.rb new file mode 100644 index 0000000..0bbc627 --- /dev/null +++ b/Chris-Game/model.rb @@ -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 diff --git a/Chris-Game/view.rb b/Chris-Game/view.rb new file mode 100644 index 0000000..b178188 --- /dev/null +++ b/Chris-Game/view.rb @@ -0,0 +1,76 @@ +module DeafGrandmaView + + module Print + + class << self + def title + content = <