Skip to main content

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.

  1. Create a Custom Game

    • Subclass State, Action, Observation, and Game to define your game’s rules and mechanics.
  2. Define Players

    • Subclass Player to define how players interact with the game.
  3. Run the Game

    • Create a Game object with players and an initial state, then call the play() method.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arelai-0.0.7.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arelai-0.0.7-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

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

Hashes for arelai-0.0.7.tar.gz
Algorithm Hash digest
SHA256 3936ef36f4bb1d4167c648aab44463ac0067c02053b33c8daea1666bca334b0f
MD5 755413ec15dbf3c101cb7144cdfc1220
BLAKE2b-256 90aa530dd08425c39689862435336befe53f08b5317701fefded3fcbaa106f9a

See more details on using hashes here.

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

Hashes for arelai-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 eda8c041f307bf92b13173aa1d4b06bd8f99d85b8de8b657b9a2f821727245db
MD5 74a4b294c5d3d0866f3bdff2de9b8978
BLAKE2b-256 50f8988a1db487b3a8beb7b8c75cdaa76b121209b7000bb5e77cfc241f4cc268

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page