Skip to main content

A performant library designed for creating and managing bots in a Tetris-like game environment. This library offers various tools and features to build, test, and deploy bots efficiently to Botris.

Project description

botris-interface

GitHub license GitHub issues GitHub stars GitHub forks

botris-interface is a performant library designed for creating and managing bots in a Tetris-like game environment. This library offers various tools and features to build, test, and deploy bots efficiently to Botris.

Installation

To install the library, use the following command:

pip install botris-interface

Usage

Creating a Bot

To create a bot, you need to implement the Bot interface provided by the library. Here is an example:

from botris.bots import Bot

class CoolBot(Bot):
    async def analyze(
        self, game_state: GameState, players: List[PlayerData]
    ) -> Awaitable[List[Command]]:
        # Implement your bot logic here
        pass

Running the TetrisGame

You can run the TetrisGame using the following code:

from botris import TetrisGame
from botris.engine import Move

gs = TetrisGame()
gs.execute_move(Move.move_left)

Connecting a Bot to the Server

To connect your bot to the server, use the following code:

import asyncio
from botris import Interface

async def main():
    bot = MyBot()
    itf = Interface.create(TOKEN, ROOM_KEY, bot)
    await itf.connect()

asyncio.run(main())

License

This project is licensed under the MIT License - see the LICENSE file for details.

GitHub Repository

For more information, visit our GitHub repository.

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

botris_interface-0.1.8.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

botris_interface-0.1.8-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file botris_interface-0.1.8.tar.gz.

File metadata

  • Download URL: botris_interface-0.1.8.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Windows/11

File hashes

Hashes for botris_interface-0.1.8.tar.gz
Algorithm Hash digest
SHA256 6cbe33e0cf8729f2ba2c331e12a7b2e1d33db5439f1c584e802c387364a286b1
MD5 23f0d154d098bb5a0ca4cdfd3b2c15c9
BLAKE2b-256 f7fb583caf10ac237b0d8fc31894bc9cbb4c3a7f8f17c52b81c9f7afef97cad7

See more details on using hashes here.

File details

Details for the file botris_interface-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for botris_interface-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bbd9521c81bf842c0c557c58597a0bed82574b3a5640084976bcd24748ec5dc6
MD5 2669bd4103eb7204cac0e7b3a9ffee4e
BLAKE2b-256 44122f1d7864a1dd7a8fe5a84329fdd99d74b987da2e18a600d4c4a3e6488301

See more details on using hashes here.

Supported by

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