Skip to content

dihy16/WordleSolver

Repository files navigation

WordleSolver

An interactive Wordle solver built with Python and NiceGUI.
You can play Wordle in the browser and let different AI search strategies (BFS, DFS, Entropy-based, CSP-based) automatically solve the puzzle.


1. Requirements

  • Python: 3.9+ (project was tested with Python 3.9)
  • OS: Windows, macOS, or Linux
  • Dependencies: listed in requirements.txt

You can either use the provided virtual environment in env/ (Windows), or create your own.


2. Setup

From the project root (WordleSolver/), you have two main options.

  • Option A – Use your own virtual environment (recommended)

    1. Create and activate venv

      # from the project root
      python -m venv .venv
      
      # Windows (PowerShell)
      .venv\Scripts\Activate.ps1
      
      # Windows (cmd.exe)
      .venv\Scripts\activate.bat
      
      # macOS / Linux
      source .venv/bin/activate
    2. Install dependencies

      pip install -r requirements.txt
  • Option B – Use the existing env/ folder (Windows)
    From PowerShell in the project root:

    .\env\Scripts\Activate.ps1

3. Running the Wordle Solver GUI

Once your environment is activated and dependencies are installed, run:

python main.py

By default NiceGUI will start a local web server (typically at http://127.0.0.1:8080).
Open the printed URL in your browser.

In the UI you can:

  • Type guesses using your physical keyboard.
  • Select a solver from the dropdown (BFS, DFS, Entropy Solver, CSP Solver).
  • Optionally set a start word.
  • Click “Auto-solve” to let the chosen solver play.
  • Click “Clear All” to reset the game.

4. Project Structure (overview)

  • main.py: Entry point; starts the NiceGUI app.
  • core/
    • game.py: Core Wordle game logic (state, feedback, validity checks).
    • controller.py: Connects game logic, GUI (gui/view.py), and solvers.
  • gui/view.py: NiceGUI-based UI (grid, controls, metrics panel).
  • solvers/
    • bfs_solver.py, dfs_solver.py, entropy_solver.py, csp_solver2.py: Different search/AI strategies.
  • data/: Word lists and precomputed helpers (successors, letter-to-words).
  • experiment/: Scripts and charts for running performance experiments.
  • preprocessing/: Scripts to precompute helper structures (successors, connectivity, etc.).

5. Running Experiments

If you want to reproduce or extend the experimental evaluation of the solvers:

  1. Ensure your environment is activated and dependencies are installed.

  2. From the project root, run:

    python experiment/run_experiment.py

This will use the solvers to run batched games and write statistics/plots into experiment/stats/ and experiment/charts*/.

Note: Depending on your hardware, running all experiments may take some time.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages