/*
Package bob is for teenager handling
*/
package bob
import (
"strings"
)
// Various remark types for Bob
const (
BobQuestion int = iota
BobYell
BobQuestionYell
BobEmpty
BobDefault
)
// BobAnswer is Bob's answer for various remark types
var BobAnswer = map[int]string{
BobQuestion: "Sure.",
BobYell: "Whoa, chill out!",
BobQuestionYell: "Calm down, I know what I'm doing!",
BobEmpty: "Fine. Be that way!",
BobDefault: "Whatever.",
}
// Hey outputs Bob's answer to various remarks.
func Hey(remark string) string {
remark = strings.TrimSpace(remark)
if len(remark) == 0 {
return BobAnswer[BobEmpty]
}
if strings.ToUpper(remark) == remark && strings.ContainsAny(remark, "yxcvbnmasdfghjklqwertzuiopYXCVBNMASDFGHJKLQWERTZUIOP") {
// Yelling, not just numbers
if strings.HasSuffix(remark, "?") {
return BobAnswer[BobQuestionYell]
}
return BobAnswer[BobYell]
}
if strings.HasSuffix(remark, "?") {
return BobAnswer[BobQuestion]
}
return BobAnswer[BobDefault]
}