Skip to 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.

License

Notifications You must be signed in to change notification settings

lunathanael/botris-interface

Repository files navigation

botris-interface

GitHub license GitHub issues GitHub stars GitHub forks Wheels codecov

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.

Credits

Special thanks to ShakTris providing a reliable and fast library for this project.

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published