Wordle Machine (and Wordle Game) (in commandline)
My implementation of the Wordle game (inspired by https://www.powerlanguage.co.uk/wordle/) and my interactive solving machine for the Wordle game. The strategy is originated from this blog post Best Wordle Strategy — Explore or Exploit and I'm still working on some optimization over that.
How to run?
git clone https://github.com/KevinXuxuxu/wordle_machine.git
cd wordle_machine
- Wordle game:
# need python 3
# ! for correct letter at correct position
# ? for correct letter at wrong position
# _ for wrong letter
$ python3.9 wordle.py
Welcome to Wordle!
Guess 1: aeros # <- your input
Result: _!__!
Guess 2: unlit # <- your input
Result: ____?
Guess 3: techs # <- your input
Result: ?!_?!
Guess 4: heets # <- your input
Guess must be a proper word with 5 letters!
Guess 4: hetts # <- your input
Guess must be a proper word with 5 letters!
Guess 4: herts # <- your input
Guess must be a proper word with 5 letters!
Guess 4: hetes # <- your input
Result: !!!!!
Congrats!
- wordle machine (interactive mode)
# need python 3
# next guess is given, input the response in same format
$ python3.9 wordle_machine.py
Interactive mode:
Guess 1: aeros
Result: _?___ # <- your input
Number of possible words: 568
Guess 2: unlit
Result: _?_?_ # <- your input
Number of possible words: 52
Guess 3: binge
Result: _!!_! # <- your input
Number of possible words: 7
Guess 4: jinne
Result: _!!_! # <- your input
Number of possible words: 6
Guess 5: mince
Result: _!!!! # <- your input
Number of possible words: 2
Guess 6: wince
Result: !!!!! # <- your input
Congrats!
Benchmark
Success rate around 86% for now.
$ python3.9 benchmark.py
max 6 guesses, 10000 plays
Success stats: {1: 0, 2: 1, 3: 1674, 4: 3382, 5: 2332, 6: 1228}
Success distro: {1: 0.0, 2: 0.0001, 3: 0.1674, 4: 0.3382, 5: 0.2332, 6: 0.1228}
Failed count and rate: 1383 0.1383
TODO
- Better word choosing strategy (now just the first word in the possible list)
- Better cmd option for alternate strategy choice
- NFT?
- Web 3.0?