Last active
August 29, 2015 14:17
-
-
Save elzup/eee8c5e6de3cd1410446 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| import sys, time | |
| from random import choice | |
| def main(): | |
| match_print_interaction('名前は?', '高橋洸人') | |
| match_print_interaction('ニックネーム?', 'えるざっぷ') | |
| match_print_interaction('好きなものは?', ['アニメ', 'マイクラ']) | |
| match_print_interaction('好きな言語は?', ['PHP', 'Python']) | |
| def fl(t = 0.001): | |
| sys.stdout.flush() | |
| time.sleep(t) | |
| def match_print_interaction(q, word): | |
| print("\n", q, ) | |
| input() | |
| match_print(word) | |
| def match_print(words): | |
| if not (isinstance(words, list)): | |
| match_print([words]) | |
| return | |
| c = 0 | |
| for word in words: | |
| c += 1 | |
| l = len(word) | |
| target = '*' * l | |
| pt = list(word) | |
| while (target != word): | |
| # k = c // 100 | |
| target = target[1::] + choice(pt) | |
| # target = "".join(pt[0:k:]) + "".join(target[k::]) | |
| sys.stdout.write("\r%s" % target) | |
| fl() | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment