Exemplo n.º 1
0
def play_game(num1, num2, num3):
    turn_num = get_turn_num()

    last_num = num3
    if last_num is None:
        last_num = num2
    if last_num is None:
        last_num = num3
    if last_num is None:
        last_num = num1

    # Exceptional case: when CEK fail to match slots
    if last_num is None:
        return question('아... 다시 한번만 말해주세요')
    # check if an user keep the rule or remind
    if last_num - int(turn_num) > 2 or last_num - int(turn_num) < 0:
        return question('규칙에 어긋납니다. 다시 해주세요.').add_speech(turn_num + "을 말할 차례입니다.")

    if last_num >= 31:
        # when user lose
        return statement("제가 이겼네요. 하하하.")
    if last_num == 30:
        # expect not to reach this code line
        return statement("제가 졌네요.. 개발자가 잘못만들었다.")

    speech_num  = make_number_to_speech(last_num)
    speech = speech_num
    if not speech:
        speech = str(last_num + 1)
    return question(speech).add_speech("이제 너 차례").reprompt("그만 할거야?")
Exemplo n.º 2
0
def play_game(num1, num2, num3):
    turn_num = get_turn_num()

    last_num = num3
    if last_num is None:
        last_num = num2
    if last_num is None:
        last_num = num3
    if last_num is None:
        last_num = num1

    # Exceptional case: when CEK fail to match slots
    if last_num is None:
        return question('아... 다시 한번만 말해주세요')
    # check if an user keep the rule or remind
    if last_num - int(turn_num) > 2 or last_num - int(turn_num) < 0:
        return question('규칙에 어긋납니다. 다시 해주세요.').add_speech(turn_num +
                                                          "을 말할 차례입니다.")

    if last_num >= 31:
        # when user lose
        return statement("제가 이겼네요. 하하하.")
    if last_num == 30:
        # expect not to reach this code line
        return statement("제가 졌네요.. 개발자가 잘못만들었다.")

    speech_num = make_number_to_speech(last_num)
    speech = speech_num
    if not speech:
        speech = str(last_num + 1)
    return question(speech).add_speech("이제 너 차례").reprompt("그만 할거야?")
Exemplo n.º 3
0
def answer(ans):
    attr = session.sessionAttributes
    ask_word = attr.get('word')
    usr_word = words_set.get(ans)
    if ask_word is None:
        return not_play_game()
    elif usr_word is None:
        return statement("단어 사전 미등록..")
    elif usr_word == ask_word:
        word = make_question()
        return question("정답입니다.").add_speech("이건 뭘까요?").add_speech(word, lang='ja').reprompt(word, lang='ja')
    else:
        return question("틀렸습니다. 다시 들어보세요.").add_speech(ask_word ,lang='ja').reprompt(ask_word, lang='ja')
Exemplo n.º 4
0
def answer(ans):
    attr = session.sessionAttributes
    ask_word = attr.get('word')
    usr_word = words_set.get(ans)
    if ask_word is None:
        return not_play_game()
    elif usr_word is None:
        return statement("단어 사전 미등록..")
    elif usr_word == ask_word:
        word = make_question()
        return question("정답입니다.").add_speech("이건 뭘까요?").add_speech(
            word, lang='ja').reprompt(word, lang='ja')
    else:
        return question("틀렸습니다. 다시 들어보세요.").add_speech(
            ask_word, lang='ja').reprompt(ask_word, lang='ja')
Exemplo n.º 5
0
def ihyungyoungsa():
    speech = "이 형용사를 공부해봅시다. 뜻을 말해보세요"
    word = make_question()
    session.sessionAttributes['play'] = 'ihyungyoungsa'

    return question(speech).add_speech(word, lang='ja').reprompt(word,
                                                                 lang='ja')
Exemplo n.º 6
0
def launch():
    session.sessionAttributes = {
        'turn_num': '3'
    }
    return question('안녕 베스킨라빈스 게임을 시작합니다.')\
        .add_speech('하나, 둘')\
        .reprompt("당신 차례입니다.일, 이")
Exemplo n.º 7
0
def not_play_game():
    speech1 = "다른 말씀을 하시면 곤란합니다."
    attr = session.sessionAttributes
    ask_word = attr.get('word')
    if ask_word is None:
        ask_word = 'しっかりしてください'

    return question(speech1).add_speech(ask_word, lang='ja').reprompt(ask_word, lang='ja')
Exemplo n.º 8
0
def whats_my_color():
    color = session.attributes.get(COLOR_KEY)
    if color is not None:
        statement_text = render_template('known_color_bye', color=color)
        return statement(statement_text)
    else:
        question_text = render_template('unknown_color_reprompt')
        return question(question_text).reprompt(question_text)
Exemplo n.º 9
0
def my_color_is(color):
    if color is not None:
        session.attributes[COLOR_KEY] = color
        question_text = render_template('known_color', color=color)
        reprompt_text = render_template('known_color_reprompt')
    else:
        question_text = render_template('unknown_color')
        reprompt_text = render_template('unknown_color_reprompt')
    return question(question_text).reprompt(reprompt_text)
Exemplo n.º 10
0
def not_play_game():
    speech1 = "다른 말씀을 하시면 곤란합니다."
    attr = session.sessionAttributes
    ask_word = attr.get('word')
    if ask_word is None:
        ask_word = 'しっかりしてください'

    return question(speech1).add_speech(ask_word,
                                        lang='ja').reprompt(ask_word,
                                                            lang='ja')
Exemplo n.º 11
0
def give_answer():
    attr = session.sessionAttributes
    ask_word = attr.get('word')
    if ask_word is None:
        # when user ask answer before play
        # and end process.
        return statement('물어본적이 없는데 어떻게 정답을 말하나요.').add_speech('서비스 종료합니다.')
    for key ,word in words_set.items():
        # find matched word
        # and give new random question.
        if word == ask_word:
            ans = key
            next_word = make_question()
            return question('정답은 ' + ans + '입니다. 다른 단어를 들려드릴게요').add_speech(next_word, lang='ja')
    return statement('착오가 있었네요 개발자 잘못입니다. ㅠ')
Exemplo n.º 12
0
def give_answer():
    attr = session.sessionAttributes
    ask_word = attr.get('word')
    if ask_word is None:
        # when user ask answer before play
        # and end process.
        return statement('물어본적이 없는데 어떻게 정답을 말하나요.').add_speech('서비스 종료합니다.')
    for key, word in words_set.items():
        # find matched word
        # and give new random question.
        if word == ask_word:
            ans = key
            next_word = make_question()
            return question('정답은 ' + ans + '입니다. 다른 단어를 들려드릴게요').add_speech(
                next_word, lang='ja')
    return statement('착오가 있었네요 개발자 잘못입니다. ㅠ')
Exemplo n.º 13
0
def dongsa():
    speech = "동사는 준비중입니다. 이 형용사를 해보는건 어떤가요?"
    return question(speech)
Exemplo n.º 14
0
def ihyungyoungsa():
    speech = "이 형용사를 공부해봅시다. 뜻을 말해보세요"
    word = make_question()
    session.sessionAttributes['play'] = 'ihyungyoungsa'

    return question(speech).add_speech(word, lang='ja').reprompt(word, lang='ja')
Exemplo n.º 15
0
def launch():
    return question('안녕하세요. 일본어 단어 공부를 시작해 볼까요?')\
        .add_speech('おはようございます あなたの日本語先生です。', lang='ja')\
        .add_speech('어떤 학습을 하고 싶으세요?')
Exemplo n.º 16
0
def launch():
    speech_text = "안녕하세요? 마법구슬이에요. 무엇이든 저에게 물어보세요."
    return question(speech_text)
Exemplo n.º 17
0
def launch():
    speech_text = render_template('welcome')
    return question(say.English(speech_text)).reprompt(say.Korean('아무도 없나요~?'))
Exemplo n.º 18
0
def not_play_game():
    print(session)
    speech1 = "다른 말씀을 하시면 곤란합니다."
    turn_num = get_turn_num()
    return question(speech1).add_speech(turn_num + "을 말씀하실 차례입니다.")
Exemplo n.º 19
0
def launch():
    return question('안녕하세요. 일본어 단어 공부를 시작해 볼까요?')\
        .add_speech('おはようございます あなたの日本語先生です。', lang='ja')\
        .add_speech('어떤 학습을 하고 싶으세요?')
Exemplo n.º 20
0
def launch():
    speech_text = render_template('welcome')
    return question(speech_text, lang='en').reprompt('아무도 없나요~?')
Exemplo n.º 21
0
def launch():
    question_text = render_template('welcome')
    reprompt_text = render_template('welcome_reprompt')
    return question(question_text).reprompt(reprompt_text)
Exemplo n.º 22
0
def launch():
    speech_text = "몇개의 주사위를 던질까요?"
    session.sessionAttributes['intent'] = 'ThrowDiceIntent'

    return question(speech_text)
Exemplo n.º 23
0
def launch():
    question_text = render_template('welcome')
    reprompt_text = render_template('welcome_reprompt')
    return question(say.Korean(question_text))\
        .reprompt(say.Korean(reprompt_text))
Exemplo n.º 24
0
def launch():
    session.sessionAttributes = {'turn_num': '3'}
    return question('안녕 베스킨라빈스 게임을 시작합니다.')\
        .add_speech('하나, 둘')\
        .reprompt("당신 차례입니다.일, 이")
Exemplo n.º 25
0
def guide_intent():
    return question("주사위 한 개 던져줘, 라고 시도해보세요.")
Exemplo n.º 26
0
def launch():
    speech_text = 'Welcome to the CEK World'
    return question(speech_text, lang='en').reprompt('Re ' + speech_text,
                                                     lang='en')
Exemplo n.º 27
0
def dongsa():
    speech = "동사는 준비중입니다. 이 형용사를 해보는건 어떤가요?"
    return question(speech)
Exemplo n.º 28
0
def not_play_game():
    print(session)
    speech1 = "다른 말씀을 하시면 곤란합니다."
    turn_num = get_turn_num()
    return question(speech1).add_speech(turn_num + "을 말씀하실 차례입니다.")
Exemplo n.º 29
0
def launch():
    speech_text = 'Welcome to the CEK World'
    return question(say.English(speech_text)).reprompt(
        say.English('Re ' + speech_text))
Exemplo n.º 30
0
def launch():
    return question(",").reprompt("응?")