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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file botris_interface-0.1.12.tar.gz
.
File metadata
- Download URL: botris_interface-0.1.12.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cebde7daf6c65ee3873d6b8b4c0d1da609f468b70334c23374baa00684f67b65 |
|
MD5 | fb8949c0a29fcb590e6a89a7dafc41ff |
|
BLAKE2b-256 | 607154ff9c6bba38ed45b3016ffe375d140ac32b47bab0c987d577ecc97b544a |
File details
Details for the file botris_interface-0.1.12-py3-none-any.whl
.
File metadata
- Download URL: botris_interface-0.1.12-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca8a04d3a80ac3db6e7b369ba8be41a9664de5c1677b753a01fd7f6f6bc156da |
|
MD5 | 007199a142ae2ac428c9180a662b1881 |
|
BLAKE2b-256 | ae16309ff9b9470e6a8b97dd74d35b4374983cfe3827038973207554a944eece |