GithubHelp home page GithubHelp logo

gettds's Introduction

This project is a shameless ripoff of the great work done by Yin Ki Ng

Wordle Solvers in Python

Quick Start (Command Line)

Playing a 5-letter Wordle game

In command line, run $ python main.py interactive

The program will guess a first word and let you type the response with the specified format.

Interactively guess a word

Based on your response, the program will pick a new guess word and the process repeats.

Interactively guess a word

Your can also specify a target word by running

$ python main.py interactive --with_target

The program will simulate the guessing process with an automatically generated response to each of its guess.

Simulation

Quick Start (iPython Notebook)

See demo.ipynb.

Wordle Solvers Basic Info

The Heuristic solver

HeuristicWordlePlayer

  • Picks the guess based on character frequencies
  • A word scores higher if it is composed of common characters rather than rare characters
  • The worse and average number of guesses is 6 and ~3.82, with the first guess as "raise"
  • Computes on-the-fly.

The Maximum Information Gain Solver

MaxInformationGainWordlePlayer

  • Picks the guess based on maximizing information gain
  • A word scores higher if it generates the maximum Shannon entropy from its response distribution (the count of all possible response outcomes with respect to the available target words).
  • The worse and average number of guesses is 5 and ~3.65, with the first guess as "react"
  • Computes slower and is optimized by pre-computation
  • Providing a larger word list as the guess list improves the average number of guesses to ~3.60 with the start word as "reast", "trace" etc

More Command Line Options

$ python main.py --solver <solver> --first_guess <first-guess> <mode> <mode arguments>

The <solver> is either heuristic, small-mig, or large-mig. (mig stands for Maximum Information Gain). The default is heuristic.

The <first-guess> specifies a fixed word for the solver to use in the first guess. The default is raise.

The <mode> is either interactive or analysis and the mode arguments are as follows:

  • interactive: (examples as above) guess an unknown target with the manual response from the user, or add --with_target to specify a simulation process.

  • analysis: for analyzing the worst and average number of guesses of the solver.

    Run $ python main.py analysis and the solver will simulate the guessing process for all potential target words using the fixed first guess word (see above to change the first guess word).

    Run $ python main.py analysis --topK <topK> to run the above analysis for the automatically selected top-K first-guess words (that have the highest internal solver score).

    Analysis

    Statistics is saved in the /output folder.

gettds's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.