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
Metadata
Release files for arelai 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arelai-0.0.7.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arelai-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.1 kB
Release files / arelai-0.0.7.tar.gz
| Download URL | arelai-0.0.7.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3936ef36f4bb1d4167c648aab44463ac0067c02053b33c8daea1666bca334b0f
|
|
BLAKE2b-256 checksum How to use checksums |
90aa530dd08425c39689862435336befe53f08b5317701fefded3fcbaa106f9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.6
|
Release files / arelai-0.0.7-py3-none-any.whl
| Download URL | arelai-0.0.7-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eda8c041f307bf92b13173aa1d4b06bd8f99d85b8de8b657b9a2f821727245db
|
|
BLAKE2b-256 checksum How to use checksums |
50f8988a1db487b3a8beb7b8c75cdaa76b121209b7000bb5e77cfc241f4cc268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.6
|