WORDLE猜词辅助器

WORDLE猜词辅助器


github链接: https://github.com/yuxin-hong-91/wordle-killer

下载

  首先,从网上一位好心网友处下载一个正序英语单词列表的txt:

链接:https://pan.baidu.com/s/11FThsKjsAdK3DixmGzgHWQ
提取码:xhik

重命名

  其次,把这个txt的文件名改成words.txt,在同一个目录下创建一个.py文件,把以下代码复制进去并运行,按照提示进行操作即可。

复制与运行

import numpy as np

def have(word, lst):
    for c in lst:
        if not(c in word):
            return False
    return True

def donthave(word, lst):
    for c in lst:
        if c in word:
            return False
    return True

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    f = open("words.txt")
    line = f.readline()
    data_list = []
    while line:
        data_list.append(line[:-1])
        line = f.readline()
    f.close()
    data_array = np.array(data_list)

    h_str = input("请按空格输入已知存在的字母(小写):")
    h = h_str.split(" ")
    dh_str = input("请按空格输入已知不存在的字母(小写):")
    dh = dh_str.split(" ")

    correct = []
    for word in data_array:
        if len(word) == 0:
            continue
        if word[0].isupper():
            continue
        if len(word) == 5:
            if have(word, h):
                if donthave(word, dh):
                    correct.append(word)

    b = 'yes'
    known = dict()
    while 'y' in b:
        b = input("是否存在已知位置的字母?(yes/no):")
        if 'y' in b:
            index = int(input("请输入第几位数是已知的:"))
            char = input("请输入该字母:")
            known[index] = char

    print("以下是符合条件的单词:")
    for word in correct:
        s = True
        for key, value in known.items():
            if word[key - 1] != value:
                s = False
                break
        if s:
            print(word)

    s = input('使用任意输入以关闭窗口')
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

失眠软糖12

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值