Skip to content

Instantly share code, notes, and snippets.

@fractalatcarf
Created March 28, 2017 16:38
Show Gist options
  • Save fractalatcarf/79b56d79904decca7bc8282bde0f9170 to your computer and use it in GitHub Desktop.
Save fractalatcarf/79b56d79904decca7bc8282bde0f9170 to your computer and use it in GitHub Desktop.
Live code du 28 mars, Stupid coaching
def coach_answer(your_message)
# TODO: return coach answer to your_message
good_message = "I am going to work right now!"
if your_message.end_with?("?")
return "Silly question, get dressed and go to work!"
elsif your_message.upcase != good_message.upcase
return "I don't care, get dressed and go to work!"
else
return ""
end
end
def coach_answer_enhanced(your_message)
# TODO: return coach answer to your_message, with additional custom rules of yours!
regular_answer = coach_answer(your_message)
if your_message == your_message.upcase
# return regular_answer == "" ? "" : "I can feel your motivation! #{regular_answer}"
if regular_answer == ""
return ""
else
return "I can feel your motivation! #{regular_answer}"
end
end
regular_answer
end
# puts coach_answer("good morning") # expected : I don't care, get dressed and go to work!
# puts coach_answer("good morning ?") # expected : Silly question, get dressed and go to work!"
# puts coach_answer("I am going to work right now!") # expected : nothing
# puts coach_answer_enhanced("GOOD MORNING") # expected : I can feel motivation + I don't care ...
# puts coach_answer_enhanced("GOOD MORNING ?") # expected : motivation + Silly question
# puts coach_answer_enhanced("I AM GOING TO WORK RIGHT NOW!") # expected : motivation + nothing
require_relative "coach_answer"
# TODO: Implement the program that makes you discuss with your coach from the terminal.
coach_response = "ee"
until coach_response == ""
puts "Ask your coach"
message = gets.chomp
coach_response = coach_answer_enhanced(message)
puts coach_response
end
# ask question
# get response in a varaible called "message"
# ask coach with message
# until coach response is ""
# ask question
# get response in a varaible called "message"
# ask coach with message
# end of until
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment