Analysis of a daily word game "Wordle"

Overview

Wordle

Analysis of a daily word game "Wordle"

https://www.powerlanguage.co.uk/wordle/

Description

Worlde is a daily word game in which a player attempts to guess a 5-letter word in at most 6 trials. After each guess for each letter he recieves a response whether or not it is present in a word and if so, is it in correct position. Thus, for each letter we have three options:

  • The letter is correct and in a correct position, denoted by a green colour and letter C in this project
  • The letter is correct (i.e. it exists in a word) but in an incorrect position, denoted by a yellow colour and letter I in this project
  • The letter is incorrect (i.e. is not present in a word), denoted by a gray colour and letter O in this project

The game has two variants: easy and hard. An easy variant allows to guess any word at each stage of the game. The hard version forces the player to guess the word that conforms to the information that has already been discovered (e.g. he is not allowed to guess the words which contain letters that were previously revealed to not be present in a word). In this project we focus on the hard variant.

Instalation

The project requires several packages - the information is contained in the requirements.txt file and can easily be installed with:

using pip

pip install -r requirements.txt

using Conda

conda create --name <env_name> --file requirements.txt

Aim

The aim of the project is to find the strategy that guesses the word in as little number of guesses as possible.

Files

wordle.py

Main package of the project - contains all the code needed to generate game tree and compute the best possible strategy. It implements two classes:

  • GameState: tracks the state of the game - which letters have been eliminated, which are in their correct positions and which exist in a word but at a different position

  • Node: tree data structure for keeping track of all possible scenarios of the game

words.py

Scrapes the list of 5-letter english words from the website:

https://www.bestwordlist.com/

game.py

Simulates the Wordle game by sampling a random word from the list and then repeatedly querying the player for a 5-letter guess and replying with a 5-letter response code (consisting of the letters C, I and O as described in the Description section).

Example usage:

Guess TARES and type the response: OIOOO
Guess PLAIN and type the response: OOCIO
Guess KHAZI and type the response: OOCOC
Guess ABACI and type the response: IOCOC
Guess UMAMI and type the response: CCCCC
It took 5 guesses.

solve.py

Solves the Wordle game by repeatedly providing the player with a guess and then asking him for a 5-letter response code (consisting of the letters C, I and O as described in the Description section) until there word has been guessed correctly. It needs to be provided with solver.json file which is produced by the attached Jupyter Notebook.

Example usage

Enter your guess: TARES
The response was: OIOOO
Enter your guess: PLAIN
The response was: OOCIO
Enter your guess: KHAZI
The response was: OOCOC
Enter your guess: ABACI
The response was: IOCOC
Enter your guess: UMAMI
Correct! It took you 5 guesses.

wordle.ipynb

The Jupyter Notebook with the analysis of the game which also computes the solver.json file for the optimal strategy needed for the solve.py script.

License

Project is distributed under the MIT license

Owner
Bartek
Bartek
Plumbum: Shell Combinators

Plumbum: Shell Combinators Ever wished the compactness of shell scripts be put into a real programming language? Say hello to Plumbum Shell Combinator

Tomer Filiba 2.5k Dec 28, 2022
Command line, configuration and persistence utilities

Zensols Utilities Command line, configuration and persistence utilities generally used for any more than basic application. This general purpose libra

Paul Landes 2 Nov 17, 2022
CLI Web-CAT interface for people who use VIM.

CLI Web-CAT CLI Web-CAT interface. Installation git clone https://github.com/phuang1024/cliwebcat cd cliwebcat python setup.py bdist_wheel sdist cd di

Patrick 4 Apr 11, 2022
instant coding answers via the command line

howdoi instant coding answers via the command line Sherlock, your neighborhood command-line sloth sleuth. Are you a hack programmer? Do you find yours

Benjamin Gleitzman 9.8k Jan 08, 2023
AthenaCLI is a CLI tool for AWS Athena service that can do auto-completion and syntax highlighting.

Introduction AthenaCLI is a command line interface (CLI) for the Athena service that can do auto-completion and syntax highlighting, and is a proud me

dbcli 192 Jan 07, 2023
CLI tool to show the current crypto balance

CryptoBoard The simple python CLI tool for one currency to show the current crypto balance yours purchases. That's all. Data source is from https://ww

John 2 Nov 18, 2021
🕰 The command line tool for scheduling Python scripts

hickory is a simple command line tool for scheduling Python scripts.

Max Humber 146 Dec 07, 2022
Access hacksec.in from your command-line

Access hacksec.in from your command-line

hacksec.in 3 Oct 26, 2022
Stephen's Obsessive Note-Storage Engine.

Latest Release · PyPi Package · Issues · Changelog · License # Get Sonse and tell it where your notes are... $ pip install sonse $ export SONSE="$HOME

Stephen Malone 23 Jun 10, 2022
AutoSub is a CLI application to generate subtitle files (.srt, .vtt, and .txt transcript) for any video file using Mozilla DeepSpeech.

AutoSub About Motivation Installation Docker How-to example How it works TO-DO Contributing References About AutoSub is a CLI application to generate

Abhiroop Talasila 414 Jan 06, 2023
Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process of them.

Task Manager Automation Tool (TMAT) CLI Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process

Tiamat 5 Apr 12, 2022
A CLI Application to detect plagiarism in Source Code Files.

Plag Description A CLI Application to detect plagiarism in Source Code Files. Features Compare source code files for plagiarism. Extract code features

default=dev 2 Nov 10, 2022
Low-Cost Open Source Ventilator or PAPR

Last updated 2020/04/19 Low-Cost Open-Source Ventilator-ish Device or PAPR NOTE: This is currently an independent project not affiliated with any comm

Johnny Lee 1.7k Dec 21, 2022
Regis-ltmpt-auto - Program register ltmpt 2022 automatis

LTMPT Register Otomatis 2022 Program register ltmpt 2022 automatis dibuat untuk

1 Jan 13, 2022
Turdshovel is an interactive CLI tool that allows users to dump objects from .NET memory dumps

Turdshovel Description Turdshovel is an interactive CLI tool that allows users to dump objects from .NET memory dumps without having to fully understa

Leron Gray 41 Jul 27, 2022
A CLI for creating styled-components for React projects quickly

new-component Ian Cleary (iancleary) Description Welcome! This is a CLI for creating styled-components for React projects quickly. Note: I've rewrote

Ian Cleary (he/him/his) 1 Feb 15, 2022
Amazon Scraper: A command-line tool for scraping Amazon product data

Amazon Product Scraper: 2021 Description A command-line tool for scraping Amazon product data to CSV or JSON format(s). Requirements Python 3 pip3 Ins

49 Nov 15, 2021
Interact with Replit remotely with the Replit CLI

Replit CLI pip install repl-cli Welcome to Replit CLI! With the Replit CLI Application, you can work with your repls locally, including clone, pull,

Shuchir Jain 4 Aug 18, 2022
A Python module and command-line utility for converting .ANS format ANSI art to HTML

ansipants A Python module and command-line utility for converting .ANS format ANSI art to HTML. Installation pip install ansipants Command-line usage

4 Oct 16, 2022