Some new features and fixes for banterbot and topicbot. update to chatcloud

This commit is contained in:
RussellChamp committed 2018-04-24 15:21:29 +00:00
1 parent 3da5e4073c
commit e9fc646207
10 files changed
+187 -32

No files matched your search

+10
View File
@@ -13,3 +13,13 @@ def get_puzzle():
words.sort()
answer = words[key]
return [answer, puzzle]
def get_anagram(maxlen = 6):
dict_words = [word.rstrip() for word in open(dictionary).readlines() if "'" not in word and len(word) > 2 and len(word) <= maxlen+1]
word = random.choice(dict_words)
while True:
anagram = ''.join(random.sample(word, len(word)))
if anagram != word:
break
puzzle = "Unscramble the following word: '" + anagram + "'"
return [word, puzzle]