A little python script for finding the best word choice in a Wordle game

Overview

Wordle Guesser

A little python script for finding the best word choice in a Wordle game, by assuming that at each step you want to minimise the average number of possible answers left after guessing that word (note this is a greedy assumption and not fully correct, but as a TikTok user pointed out, this is the best you can do before it gets NP-hard).

Finding the best first word

To find the best first word, run the following in python:

import wordle
guesser = wordle.WordleGuesser(full_vocab=False, only_guess_from_answers=False)
best_word, min_length = guesser.get_smart_guess(outfile="best_words.txt", verbose=True)
print("Best word: {}, gives {} possible answers left".format(best_word, min_length))

full_vocab=False means we evaluate against the possible answers and only_guess_from_answers=False means we guess from all the possible guesses, not just the possible answers. The example above saves all the words in a file called best_words.txt.

Finding the best next word

After getting a response from your guess in wordle, you can update your guesser as follows:

import wordle
guesser = wordle.WordleGuesser(full_vocab=False, only_guess_from_answers=False)
# If the game responded with Orange, Black, Orange, Black, Green
guesser.update("roate", "obobg")

You can then either print out the possible answers left, or find the next best word to guess:

print(guesser.possible_answers)
best_word, _ = guesser.get_smart_guess()
You might also like...
Searches the word list in Wordle based on search pattern.

Wordle Searcher Searches the word list in Wordle based on search pattern. Warning: like all forms of cheating, it trivializes the game, and robs you o

A very bad wordle solver to help me solve the daily wordle

Wordle Solver A very bad wordle solver to help me solve the daily wordle on https://www.powerlanguage.co.uk/wordle/ TODO list take into account letter

Wordle player - A Class that plays wordle optimally

wordle_player A Class that plays wordle optimally if you want to play wordle opt

Wordle - Implementation of wordle and a solver

Wordle - Implementation of wordle and a solver

Wordle-player - An optimal player for Wordle. Based on a rough understanding of information theory

Wordle-player - An optimal player for Wordle. Based on a rough understanding of information theory

Wordle Tas Tool is a terminal application for solving Wordle puzzles

Wordle Tas Tool Terminal application for solving Wordle puzzles Wordle Tas Tool (WTT) is a Python script that iterates over SCOWL95 to solve Wordle pu

Wordle-prophecy - The comprehensive list of all Wordle answers, past and future

About This repo contains the comprehensive list of all Wordle answers, past and

uses Entropy to find the best next guess for Wordle, given the color clues

WordleSolver uses Entropy to find the best next guess for Wordle, given the color clues use player.py and enter in the string for the suggested clue w

SpiderArcadeGame - A game where the player controls a little spider who is trying to protect herself from other invasive bugs
SpiderArcadeGame - A game where the player controls a little spider who is trying to protect herself from other invasive bugs

SpiderArcadeGame - A game where the player controls a little spider who is trying to protect herself from other invasive bugs

Comments
  • what if is this else for?

    what if is this else for?

    https://github.com/codebyzeb/wordleguesser/blob/07a7841986c522e9b826e48efe3caef84943a5f1/wordle.py#L83-L90

    I'm not a huge python person, so I was rewriting your code into javascript, since that's what I know best. Unfortunately I don't understand which if this else references, it's at the same level as the for loop.

    opened by chad3814 2
Owner
zeb
zeb
This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle

Pyal Telegram Bot This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle. How does it work? Differently from the ori

Rafael Omiya 4 Oct 6, 2022
Wordle-helper: python script to help solving wordle game

wordle-helper This is a python script to help solving wordle game 5-letter-word-

MD Nur Ahmed 2 Feb 8, 2022
For educational purposes, a simple script that assists in solving the word game Wordle.

WordleSolver For educational purposes, a simple script that assists in solving the word game Wordle. Instructions Pick your first word from the sugges

Christian De Leon 2 Mar 25, 2022
Wordle-Python - A simple low-key clone of the popular game WORDLE made with python and a 2D Graphics module Pygame

Wordle-Python A simple low-key clone of the popular game WORDLE made with python

Showmick Kar 7 Feb 10, 2022
This is a python implementation of wordle, which uses the same set of available words as the hit game, Wordle

Wordle Game This is a python implementation of wordle, which uses the same set of available words as the hit game, Wordle. Play the game manually pyth

Pierre Theo Klein 11 Mar 4, 2022
My goofy little script for playing wordle

my wordle "solver" My goofy little script for playing wordle. It actually runs really slowly at first but once you've added some info (e.g. which lett

MB 3 Feb 4, 2022
Wordle is a word game reminiscent of mastermind

Wordle is a word game reminiscent of mastermind. The player tries to guess a five letter word within six attempts. After each attempt, hints are given. Green tiles show that the letter is in the right position.

Sidharth Anand 1 Feb 9, 2022
Wordle Solver: A simple script which is also called Wordle solver

wordle-solver this code is a simple script which is also called Wordle solver. t

amirreza 1 Feb 15, 2022
Wordle - Wordle Clone With Python

Wordle Clone Python This is a cli clone of the famous wordle game developed by J

Shivam Pandya 20 Jul 7, 2022
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022