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.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

gym_wordle-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gym_wordle-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 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.1.tar.gz
Algorithm Hash digest
SHA256 e86eece4cbb6ac284c649734fb42190d093b1a0fabaf5a637e9939eabceff1a6
MD5 c335774de9981d5bd9bb304a1e2f15d7
BLAKE2b-256 4a75e1b43bf18c9d38e7177a763109d8de9b41c5902053ab85614ddf1d2060c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gym_wordle-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c2fb5ddd5ac2948fe9fef4519bafc21292b531854e82f05de3e9e06dd23d0d
MD5 549bc69266c76f4054ed490041fb5950
BLAKE2b-256 c33f813175c1ece4a55395e27243bed69ae76949c59f5be500d99a363a911907

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