Skip to main content

OpenAI gym environment for training agents on Wordle

Project description

Gym-Wordle

An OpenAI gym compatible environment for training agents to play Wordle.


User-input demo of the environment

Installation

My goal is for a minimalist package that lets you install quickly and get on with your research. Installation is just a simple call to pip:

$ pip install gym_wordle

Requirements

In keeping with my desire to have a minimalist package, there are only three major requirements:

  • numpy
  • gym
  • sty, a lovely little package for stylizing text in terminals

Usage

The basic flow for training agents with the Wordle-v0 environment is the same as with gym environments generally:

import gym
import gym_wordle

eng = gym.make("Wordle-v0")

done = False
while not done:
    action = ...  # RL magic
    state, reward, done, info = env.step(action)

If you're like millions of other people, you're a Wordle-obsessive in your own right. I have good news for you! The Wordle-v0 environment currently has an implemented render method, which allows you to see a human-friendly version of the game. And it isn't so hard to set up the environment to play for yourself. Here's an example script:

import gym
import gym_wordle

from gym_wordle.utils import to_array, to_english

env = gym.make('Wordle-v0')

env.reset()

done = False

while not done:
    env.render()
    valid = False

    while not valid:
        guess = input('Guess: ').lower()
        action = to_array(guess)

        if env.action_space.contains(action):
            valid = True

    state, reward, done, info = env.step(action)

env.render()

print(f"The word was {to_english(env.solution).upper()}")

The above script is more or less equivalent to the function play() found in gym_wordle.utils.

Documentation

Coming soon!

Examples

Coming soon!

Citing

If you decide to use this project in your work, please consider a citation!

@misc{gym_wordle,
  author = {Kraemer, David},
  title = {An Environment for Reinforcement Learning with Wordle},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/DavidNKraemer/Gym-Wordle}},
}

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

gym_wordle-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

gym_wordle-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file gym_wordle-0.1.0.tar.gz.

File metadata

  • Download URL: gym_wordle-0.1.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for gym_wordle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 37eb9a2bf557a02e6cdf18ba082ba67f74f04811109955ecea0c1559a33b1405
MD5 54e9b739bc7a2bab97c0385cef46ee17
BLAKE2b-256 b0fb7e1a1755d11a232b2873dcf0fa427d5d54389b0ef9a038ae8a971f36e334

See more details on using hashes here.

File details

Details for the file gym_wordle-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gym_wordle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for gym_wordle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa63eebd71c0c85b12128055f661e64f280e29d5e94080c86e1517944f12ef0e
MD5 63f5870c6f4dafc4af6f9edc57c358e0
BLAKE2b-256 fc625db89a86882e3782aee63b7b8c4f665f07aee2b94abf90e210538a32591c

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