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("그만 할거야?")
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')
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')
def ihyungyoungsa(): speech = "이 형용사를 공부해봅시다. 뜻을 말해보세요" word = make_question() session.sessionAttributes['play'] = 'ihyungyoungsa' return question(speech).add_speech(word, lang='ja').reprompt(word, lang='ja')
def launch(): session.sessionAttributes = { 'turn_num': '3' } return question('안녕 베스킨라빈스 게임을 시작합니다.')\ .add_speech('하나, 둘')\ .reprompt("당신 차례입니다.일, 이")
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')
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)
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)
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('착오가 있었네요 개발자 잘못입니다. ㅠ')
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('착오가 있었네요 개발자 잘못입니다. ㅠ')
def dongsa(): speech = "동사는 준비중입니다. 이 형용사를 해보는건 어떤가요?" return question(speech)
def launch(): return question('안녕하세요. 일본어 단어 공부를 시작해 볼까요?')\ .add_speech('おはようございます あなたの日本語先生です。', lang='ja')\ .add_speech('어떤 학습을 하고 싶으세요?')
def launch(): speech_text = "안녕하세요? 마법구슬이에요. 무엇이든 저에게 물어보세요." return question(speech_text)
def launch(): speech_text = render_template('welcome') return question(say.English(speech_text)).reprompt(say.Korean('아무도 없나요~?'))
def not_play_game(): print(session) speech1 = "다른 말씀을 하시면 곤란합니다." turn_num = get_turn_num() return question(speech1).add_speech(turn_num + "을 말씀하실 차례입니다.")
def launch(): speech_text = render_template('welcome') return question(speech_text, lang='en').reprompt('아무도 없나요~?')
def launch(): question_text = render_template('welcome') reprompt_text = render_template('welcome_reprompt') return question(question_text).reprompt(reprompt_text)
def launch(): speech_text = "몇개의 주사위를 던질까요?" session.sessionAttributes['intent'] = 'ThrowDiceIntent' return question(speech_text)
def launch(): question_text = render_template('welcome') reprompt_text = render_template('welcome_reprompt') return question(say.Korean(question_text))\ .reprompt(say.Korean(reprompt_text))
def launch(): session.sessionAttributes = {'turn_num': '3'} return question('안녕 베스킨라빈스 게임을 시작합니다.')\ .add_speech('하나, 둘')\ .reprompt("당신 차례입니다.일, 이")
def guide_intent(): return question("주사위 한 개 던져줘, 라고 시도해보세요.")
def launch(): speech_text = 'Welcome to the CEK World' return question(speech_text, lang='en').reprompt('Re ' + speech_text, lang='en')
def launch(): speech_text = 'Welcome to the CEK World' return question(say.English(speech_text)).reprompt( say.English('Re ' + speech_text))
def launch(): return question(",").reprompt("응?")