Skip to main content

The popular word game recreated in Python, deployable with custom answers.

Project description

Wordle

View on GitHub and PyPI.

Wordle is super fun and popular game. Unfortunately, it's new and nonstandard, meaning the backend technology is not prevalent and recreatable online. There are a couple web-based customizable Wordle tools, which work very well, but they're front-end only (you can't clone, copy, modify, or edit the back-end to deploy it to a website or run your own game). That said, the logic behind Wordle is quite simple which is why it's now a Python library, enabling all the functions of an open-sourced game.

Currently, the module is logic based and runs in a shell. I'd love it if this project was forked into a GUI-based application, possibly using pygame, allowing users to take this a step further and deploy a version with a user-interface. As it stands, the best way I can think of to deploy Wordle to the web is by using an embedded Python console like Trinket and putting it in 'run-only' mode so users can't see the source code (where the answer is). See an example of this in real deployment here.

In any case, usage of this module is wickedly simple.

import wordle

game = wordle.Wordle(word = 'HELLO', real_words = False)
game.run()

# Or even more simply:
wordle.Wordle(word = 'hello', real_words = True).run() # runs in one line. 

Instantiate a game object using game = wordle.Wordle(). The two positional requirements of the Wordle class are word and real_words. word is the answer to the game. If the object is instantiated with real_words = True, word must be a real, five-letter word or an exception will be raised, and you'll have to change your instantiation to reflect a real word. real_words is a boolean. If it's True, the package will check user's (in-game) guesses against a comprehensive inbuilt database of thousands of five-letter words. If it's False, any guess (real or not) will be accepted. In summary, real_words applies both to the answer in the code's instantiation and in the user's in-game guesses.

In the game of Wordle, part of the challenge is that guesses must be real words. This prevents users from guessing "aeiou" as their first attempt, for example. That's it's relevant and important for you to tell the game object whether it should check for real words or not.

Note: In version 1.5.10, the issue disallowing a lower-case word has been patched. word = 'hello' and word = 'HELLO' are both acceptable in the game initialization.

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

wordle-python-1.7.10.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

wordle_python-1.7.10-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file wordle-python-1.7.10.tar.gz.

File metadata

  • Download URL: wordle-python-1.7.10.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for wordle-python-1.7.10.tar.gz
Algorithm Hash digest
SHA256 854211b9ca5bfb87f0f8feee6c47eed6ce951c8d21532617c3c1765a68545477
MD5 d5e0a27d270edaf3aa91b97ebe885c79
BLAKE2b-256 897a981081da74f64207bcd098a596afa85e7ddc5ab3882fddd29d1cc9d05622

See more details on using hashes here.

File details

Details for the file wordle_python-1.7.10-py3-none-any.whl.

File metadata

  • Download URL: wordle_python-1.7.10-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for wordle_python-1.7.10-py3-none-any.whl
Algorithm Hash digest
SHA256 51be36f20d6bea8953c006d65d9fa9c1e495a6a82b552353b90eecfba7f3e995
MD5 a3ab8a5757aa285639fc5e586109c435
BLAKE2b-256 05f82b60d1e2638ea66749e6512060d555f883fd6a6b07419c94b4cd2e812754

See more details on using hashes here.

Supported by

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