Last active
May 8, 2019 11:42
-
-
Save vestige/5de448837bcde3286885a8da06edd668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'responder' | |
require 'dictionary' | |
class Unmo | |
def initialize(name) | |
@name = name | |
@dict = Dictionary.new | |
@resp_what = WhatResponder.new('Wht', @dict) | |
@resp_random = RandomResponder.new('Rnd', @dict) | |
@resp_pattern = PatternResponder.new('Ptn', @dict) | |
@responder = @resp_pattern | |
end | |
def dialogue(input) | |
case rand(100) | |
when 0..59 | |
@responder = @resp_pattern | |
when 60..89 | |
@responder = @resp_random | |
else | |
@responder = @resp_what | |
end | |
return @responder.response(input) | |
end | |
def responder_name | |
return @responder.name | |
end | |
attr_reader :name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment