Skip to main content

AICA Game Library Fork

This package is a fork of the AICA Game Library for the Game AI Competition Platform of the AI Club Aachen. It contains the shared base interfaces and the Tic-Tac-Toe implementation only. It is designed to be easy to use. Simply instantiate the Agent class and begin!

Installation

You can install the package via pip:

pip install aica-gamelib-fork

Creating an Agent

To create a game AI agent, you need to create a class that inherits from gamelib.GAME.agent.Agent. GAME is replaced by the relevant game. In this fork, the available game is tictactoe. You must implement two methods:

  1. initialize(self, agent_init_data): Setup your agent (e.g., store your player ID).
  2. get_move(self, game_state): Analyze the game state and return a Move object.

Game Concepts

GameState

The GameState object passed to get_move is defined in gamelib.GAME.gamestate.

Move

The Move object returned by get_move is defined in gamelib.GAME.move.

Example in TicTacToe

Here is a simple example of a tictactoe agent that selects the first available cell on the board.

from typing import override

from gamelib.tictactoe import Agent, GameState, Move

class MyTicTacToeAgent(Agent):
    @override
    def initialize(self, agent_init_data: dict) -> None:
        """
        Called once at the start of the game.
        agent_init_data contains 'player_id' (0 or 1).
        """
        self.player_id = agent_init_data["player_id"]

    @override
    def get_move(self, game_state: GameState) -> Move:
        """
        Called every turn. Returns the move you want to make.
        """
        # The board is a flat list of 9 integers
        # -1: Empty, 0: Player 0, 1: Player 1
        for position in range(9):
            if game_state.board[position] == -1:
                return Move(player=self.player_id, position=position)
        
        raise ValueError("No valid moves available.")

if __name__ == "__main__":
    # Instantiate and start the agent (run by the platform)
    agent = MyTicTacToeAgent()
    agent.start()

You can import this example agent right away with:

from gamelib.tictactoe.examples import TicTacToeAgent

Running Your Agent

The agent uses standard input/output (stdin/stdout) to communicate with the game engine, when running on the platform. This is handled automatically as long as your agent is a subclass of gamelib.GAME.agent.Agentand properly started in the __main__ block.

To test locally, you can use the DevRunner provided in the gamelib.GAME.dev_runner module:

from gamelib.tictactoe import DevRunner

runner = DevRunner()
agent1 = TicTacToeAgent()
agent2 = TicTacToeAgent()
runner.add_agent(agent1)
runner.add_agent(agent2)
runner.start()

Metadata

Release files for aica-gamelib-fork 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aica-gamelib-fork 0.1.0
File Size Uploaded Provenance
aica_gamelib_fork-0.1.0.tar.gz 68.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aica-gamelib-fork 0.1.0
File Interpreter ABI Platform
aica_gamelib_fork-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 88.7 kB

Release files / aica_gamelib_fork-0.1.0.tar.gz

Download URL aica_gamelib_fork-0.1.0.tar.gz
Size 68.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2853043c898aaed37d566d874aa9ad788dae122462c86e45ae1ad4daa35f1262
BLAKE2b-256 checksum
How to use checksums
9f16d49fd7d678ede1bd633681b5fd6efc4e185c163e8e62a42b2c7a7850117a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / aica_gamelib_fork-0.1.0-py3-none-any.whl

Download URL aica_gamelib_fork-0.1.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b0eb954dcba9b5cd9e5166f35004c95ecbb26f444a1bf8817729022adcfa577
BLAKE2b-256 checksum
How to use checksums
6b3452330a85108fcdb2976b89f898b6e78ca87646bd880cc677e8a4294418b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for aica-gamelib-fork 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page