A library for creating games and training agents using reinforcement learning.
Project description
Arelai
Arelai is a framework for creating games and training agents using reinforcement learning (RL). It includes core components like states, actions, observations, and players that can be customized for specific games.
Usage
Using the framework is simple.
-
Create a Custom Game
- Subclass
State,Action,Observation, andGameto define your game’s rules and mechanics.
- Subclass
-
Define Players
- Subclass
Playerto define how players interact with the game.
- Subclass
-
Run the Game
- Create a
Gameobject with players and an initial state, then call theplay()method.
- Create a
Example
class MyState(State):
# Define the game state
class MyAction(Action):
# Define an action structure
class MyObservation(Observation):
# Define an observation structure
class MyPlayer(Player):
def get_all_actions(self, state: MyState) -> list[MyAction]:
# Return a list of actions
def select_action(self, list[MyAction], observation: MyObservation, simulate_action_fnc: Callable[[Action], Observation]) -> MyAction:
# Select an action for the player
class MyGame(Game):
def log(self):
# Define anything that should be logged for the round
def terminal(self) -> bool:
# Define the game-ending condition
def observe(self, player: MyPlayer, state: MyState) -> MyObservation:
# Return the observation for the player
def all_actions(self, player: MyPlayer, state: MyState) -> list[MyAction]:
# Return all possible actions for the player
def apply_action(self, state: State, action: Action) -> State:
# Apply the action profile and return the new state
def calculate_reward(self,player: Player, old_state: MyState, action: MyAction, new_state: MyState) -> float:
# Calculate the reward from the environment for the player
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arelai-0.0.7.tar.gz.
File metadata
- Download URL: arelai-0.0.7.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3936ef36f4bb1d4167c648aab44463ac0067c02053b33c8daea1666bca334b0f
|
|
| MD5 |
755413ec15dbf3c101cb7144cdfc1220
|
|
| BLAKE2b-256 |
90aa530dd08425c39689862435336befe53f08b5317701fefded3fcbaa106f9a
|
File details
Details for the file arelai-0.0.7-py3-none-any.whl.
File metadata
- Download URL: arelai-0.0.7-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eda8c041f307bf92b13173aa1d4b06bd8f99d85b8de8b657b9a2f821727245db
|
|
| MD5 |
74a4b294c5d3d0866f3bdff2de9b8978
|
|
| BLAKE2b-256 |
50f8988a1db487b3a8beb7b8c75cdaa76b121209b7000bb5e77cfc241f4cc268
|