流枫模拟器:修订间差异
来自 LNN的:not(博客)?
更多操作
以“<source lang="python"> import random def find(sup, *subs): for sub in subs: if sup.find(sub) != -1: return True return False def chance(prob): return...”为内容创建页面 |
小无编辑摘要 |
||
| 第1行: | 第1行: | ||
[https://tieba.baidu.com/home/main?un=zeng135792468m 流枫-沐珀◆]模拟器 | |||
<source lang="python"> | <source lang="python"> | ||
import random | import random | ||
2021年8月29日 (日) 18:52的版本
流枫-沐珀◆模拟器
import random
def find(sup, *subs):
for sub in subs:
if sup.find(sub) != -1:
return True
return False
def chance(prob):
return random.random() < prob
def liufengReply(post):
if find(post, "lq", "猎奇", "文游"):
pass
elif find(post, "新人", "萌新") and find(post, "报道", "报到"):
return "欢迎…新人" + random.choice([ "记得", "要", "请" ]) + "看吧规哦…"
else:
reply = None
if find(post, "流枫"):
if find(post, "流枫是") and find(post, "呢", "吗", "?", "?"):
if not find(post, "机器人", "全自动", "AI") and chance(0.4):
reply = "不是"
else:
reply = "是"
if chance(0.5):
reply += "的"
if chance(0.5):
reply += "呢"
elif find(post, "好怪", "怪哦", "怪噢", "怪喔", "对胃口"):
reply = "还好吧"
elif find(post, "什么", "为啥", "怎么做", "呢?", "吗") and chance(0.6):
reply = "不知道呢"
if find(post, "做女生", "做女孩子", "当女孩子") and chance(0.2):
reply += "…不是女孩子"
elif find(post, "有没有"):
reply = "没有"
if chance(0.5):
reply += "呢"
if reply:
if len(reply) > 2 and chance(0.5):
reply = "唔…" + reply
if find(reply, "…") and chance(0.3):
reply += "#(小乖)"
else:
reply += "…"
return reply
try:
while True:
print("< " + liufengRelpy(input("> ")))
print()
except EOFError: pass