“流枫模拟器”的版本间的差异

来自个人维基
跳转至: 导航搜索
第47行: 第47行:
 
try:
 
try:
 
   while True:
 
   while True:
     print("< " + liufengRelpy(input("> ")))
+
     print("< %s" % str(liufengRelpy(input("> "))))
 
     print()
 
     print()
 
except EOFError: pass
 
except EOFError: pass
 
</source>
 
</source>
 
[[分类:整活]]
 
[[分类:整活]]

2021年8月29日 (日) 18:54的版本

流枫-沐珀◆模拟器

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("< %s" % str(liufengRelpy(input("> "))))
    print()
except EOFError: pass