KNU Gymnasium, or Kymnasium for Reinforcement Learning Environments
Welcome to Kymnasium! This project is a collection of reinforcement learning environments developed for the Artificial Intelligence course at the Department of Computer Science and Engineering, Kangwon National University.
About the Project
Kymnasium provides a simple and effective platform for students to learn, implement, and test reinforcement learning algorithms. The environments are designed to be straightforward, allowing you to focus on the core concepts of RL. This project is inspired by Gymnasium.
Environments
- Alkkagi: A Korean traditional game where the objective is to flick your stones to knock the opponent's stones off the board.
- Avoid Blurp: An environment where the Mario must move left and right to avoid free-falling Blurps.
- Bullet Bill: An environment where the Mario must jump around to avoid flying Bullet Bills.
- Grid World: A classic grid-world environment where the agent navigates a maze to reach a goal.
- Zelda's Adventure: A game where the Link must navigate a maze and fight against enemies to reach a goal.
Getting Started
Installation
pip -U install kymnasium
Implement Your Agent
To train your own agent, you need to override 'kymnasium.Agent' and implement three methods as below:
import kymnasium as kym
# Your agent logic goes here
class YourAgent(kym.Agent):
def act(self, observation: any, info: dict):
# Replace this with your agent's action selection logic return env.action_space.sample()
pass
@classmethod
def load(cls, path: str) -> 'kym.Agent':
# Load a pre-trained agent
pass
def save(self, path: str):
# Save the trained agent
pass
Basic Training loop
import gymnasium as gym
# Train the agent for 100 episodes
EPISODES = 100
# Path for saving your agent
PATH_AGENT = 'agent.pkl'
agent = YourAgent()
# Create the environment
env = gym.make(
id="kymnasium/GridWorld-Crossing-26x26", # Environment ID
render_mode='rgb_array', # or 'human',
obs_type='custom', # or 'image'
bgm=False # or True for playing background music
)
for _ in range(EPISODES):
observation, info = env.reset()
done = False
while not done:
action = agent.act(observation, info)
observation, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
# Here writes any training logic
# Close the environment
env.close()
# Save your agent
agent.save(PATH_AGENT)
Live Evaluation of Your Agent
import kymnasium as kym
agent = YourAgent.load(PATH_AGENT)
kym.evaluate(
env_id='kymnasium/GridWorld-Crossing-26x26',
agent=agent,
render_mode='human',
bgm=True,
seed=42
)
Manual Play
If you want to manually play the environment, see below:
from kymnasium.envs.grid_world import ManualPlayWrapper
agent = ManualPlayWrapper(
env_id='kymnasium/GridWorld-Crossing-26x26',
bgm=True,
debug=True
)
agent.play(seed=42)
Metadata
Release files for kymnasium 1.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kymnasium-1.2.9.tar.gz | 5.6 MB | Without provenance | Details for kymnasium-1.2.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kymnasium-1.2.9-py3-none-any.whl | Python 3 | none | any | Details for kymnasium-1.2.9-py3-none-any.whl |
Total release size: 11.2 MB
Release files / kymnasium-1.2.9.tar.gz
| Download URL | kymnasium-1.2.9.tar.gz |
|---|---|
| Size | 5.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
608ed6f290575d2044cf7376dea98ecd865561cb592df0a07c8a655b17625176
|
|
BLAKE2b-256 checksum How to use checksums |
9544829729306a04f1e4d144e2b42a5bf903681a7aabee84b2d0c6cf0b26820d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / kymnasium-1.2.9-py3-none-any.whl
| Download URL | kymnasium-1.2.9-py3-none-any.whl |
|---|---|
| Size | 5.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84bf4f0b0d19bc059bfef8472a7fc291c734517c00ce165c0cf1edbd09629867
|
|
BLAKE2b-256 checksum How to use checksums |
06e0973b882082bcd969f5e1dd8190b832810c78b890a97223fa2ac32f9e7fe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for kymnasium 1.2.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.