Skip to content

LittleNyima/wordle-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 *
MaxEntropy LittleNyima 2022-02-28 17:28 99.52 3.5983 916.5156
RandomHobee HoBeedzc 2022-02-13 22:17 98.83 ** 4.0177 ** 14.4750 **
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
        def reset(self):
            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!

About

Solver of Wordle, including a profiler.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages