Skip to main content

a library that is simply Wordle

Project description

mywordle

mywordle is a library that is simply Wordle.

Millions of people enjoy Wordle every day from the NYT. However, people cannot access it on Python and it is very difficult to customize. This library brings this game to Python and lets them put their own twist to it.

Author: Kevin Zhu

Features

  • Allows users to play Wordle
  • Allows for wordbank customization
  • Allows for multiple lengths
  • Allows for guess amount changing
  • Has a helpful keyboard color-coder

Installation

To install mywordle, use pip: pip install mywordle.

However, many prefer to use a virtual environment.

macOS / Linux:

# make your desired directory
mkdir /path/to/your/directory
cd /path/to/your/directory

# setup the .venv (or whatever you want to name it)
pip install virtualenv
python3 -m venv .venv

# install mywordle
source .venv/bin/activate
pip install mywordle

deactivate # when you are completely done

Windows CMD:

# make your desired directory
mkdir C:path\to\your\directory
cd C:path\to\your\directory

# setup the .venv (or whatever you want to name it)
pip install virtualenv
python3 -m venv .venv

# install mywordle
.venv\Scripts\activate
pip install mywordle

deactivate # when you are completely done

Information

Wordle is a game that is now owned by the NYT. The aim is to guess a 5-letter word within 6 attempts. When you guess the word, you will be given a color-coded result with the following key:

  • Green is the correct letter in the correct spot
  • Yellow is the correct letter but it is in a different spot
  • Gray/White means that the letter is not in the word.

Usage

This game aims to mimic Wordle with thousands of available words. To use it is very simple! Simply run:

from mywordle import Wordle

game = Wordle()

game.play()

Guesses/words are not case sensitive.

You may pass in a custom word to guess for but it must be 5 letters, just like guesses.

It also must be part of the guess_list. This is a list of words that are valid guesses, while word_list is a list of words that are valid starting points. Randomly generated words are from the latter, because they are more well known. However, if you want to use a custom target, it must be part of guess_list.

To check if a word falls into either, use is_valid_word or is_valid_guess

This means that you can guess with xylyl but it won't ever appear unless if you use game.play('xylyl').

An intracacy to beware of is the color prioritization. On the words, it will be easy to understand. However, on the keyboard, if a letter has been green, it will be green, regardless if the letter is yellow elsewhere or at a different time. The same applies to yellow, where a different grey will not change the color. A white letter can change to any, a gray to yellow or green, and a yellow to green.

See examples for more information.

Customization

Wordle has many variants, and this library's distinction is customization. You may change the amount of guesses or change the word length.

You may alter num_guesses to be a different amount, like 7. You may set restrict_word = False. This setting removes restrictions on word length or its appearance in the word_list, allowing any alphabetical string as a guess.

If you want to have the word magazine, guessed, you may do the following:

game.play('magazine', num_guesses = 7, restrict_word = False)

Another option is to input your own custom_word_list and/or custom_guess_list. This is sometimes preferable because it allows for a random word to be chosen while preventing a random string of characters from being the guess.

If you provide a custom_word_list, words will be randomly chosen from it, and they can have varying lengths. To save you from a headache, if you pass [] for either, any word is allowed for a target word or a guess.

If you set guesses, words may not be empty. If you set words without setting guesses, it will default to [].

For example, if you have a list of your own words that you want to use, you can have the following:

game2 = Wordle(['magazine', 'apples', 'oranges'], []) # allows any guesses after picking from this list

game2.play()

One caveat of this is that the length of the word is given away. Make sure that the player doesn't have access to the list or it is sufficiently large enough.

Disclaimer

Wordle is owned by the NYT. This library provides a version of Wordle that mimics its behavior for personal and non-commercial use.

License

The License is an MIT License found in the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mywordle-1.0.2.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mywordle-1.0.2-py3-none-any.whl (50.0 kB view details)

Uploaded Python 3

File details

Details for the file mywordle-1.0.2.tar.gz.

File metadata

  • Download URL: mywordle-1.0.2.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for mywordle-1.0.2.tar.gz
Algorithm Hash digest
SHA256 26561436d81a5e4e7960dfdcf1970e84d5c4656de5e57e8cb2e06493ec268470
MD5 d99064b145e142d82ceba11dbd26bc0e
BLAKE2b-256 e2bd167379aba2dba622564f37de4c1b248e2fccdd77a74f2c427aed2e2365fb

See more details on using hashes here.

File details

Details for the file mywordle-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: mywordle-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 50.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for mywordle-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84cecb7415e4d70131ef552ad5983880d2093d6640b6396f8e5eea44578de9e8
MD5 453fc09ae11bf798b6338f98cd607c54
BLAKE2b-256 03711b28398f9a769a3c38bc9eaf3e8401c1c595e9c2ebae62b5cb8729f1cbb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page