Wordle Solver

Open source solvers for popular game Wordle - Welcome to contribute!

This a project created by LittleNyima - good job!

And the README below is the Feb 9th version, might be a lot of commits behind the repo - go check latest update here

Wordle Solver

Implementation of Wordle - A daily word game (powerlanguage.co.uk) game and a framework of evaluating Wordle solvers.

🏆 Leaderboard

Solver Contributor Last Update (UTC+8) Success% Average Tries Time Cost *
TheGreatWzk wzk1015 2022-02-09 21:25 97.93 3.8907 13.4844
RandomPruning LittleNyima 2022-02-09 19:31 98.36 ** 4.1093 ** 27.1875

* The time cost is evaluated using time.process_time api on my PC (Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz). It reflects the performance of the algorithm, but it may not be accurate.

** Because of usage of random algorithms, the performance may vary depending on selected random seed.

Please refer to the complete leaderboard here.

🐒 Examples

  • You can play the game manually:

    from wordle import WordleGame, WordleDictionary
    
    with WordleGame(WordleDictionary()).new_game() as game:
        res, attempts = "00000", 0
        while not res == "22222":
            guess = input("Please make your guess: ").strip()
            res, attempts = game.guess(guess)
    
  • You can implement your own solver and evaluate it using profiler:

    import random
    from wordle import WordleDictionary, WordleProfiler, BaseWordleSolver
    
    class RandomWordleSolver(BaseWordleSolver):
        def __init__(self, dictionary):
            super().__init__(dictionary)
        def before_guess(self):
            pass
        def guess(self):
            return random.choice(self.dictionary)
        def after_guess(self, result):
            pass
    
    dictionary = WordleDictionary()
    profiler = WordleProfiler(dictionary)
    solver = RandomWordleSolver(dictionary)
    print(profiler.evaluate_once(solver))
    

🏃 Run

If you use ipython, for example:

ipython solver/TheGreatWzkSolver.py

Or you should install the package first then you can run your code:

python setup.py install
python solver/TheGreatWzkSolver.py

🙋‍♀️ Contribution

Welcome to create pull requests and contribute your own solver!

Related