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 Distributions
File details
Details for the file botris_interface-0.1.21.tar.gz
.
File metadata
- Download URL: botris_interface-0.1.21.tar.gz
- Upload date:
- Size: 21.5 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 | 60db32b2fb290115cbf05b7ed2904378aadd131cf5fa05d5be8b37424808cc19 |
|
MD5 | 6c1051fa9ad4c4b1393dce69331fbcb5 |
|
BLAKE2b-256 | 19cd375d776baa6d73f51a78c4300fe904441bee3ae2a5e9e5237049ffe2e9a8 |
File details
Details for the file botris_interface-0.1.21-py3-none-any.whl
.
File metadata
- Download URL: botris_interface-0.1.21-py3-none-any.whl
- Upload date:
- Size: 26.1 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 | 868090680faa107ca36781e9e46f39f0956f95100513544ad09bb0f09c4c114c |
|
MD5 | ac45fababd65e618677d812d2f6171b9 |
|
BLAKE2b-256 | 819d07c22988dbf45103902f5f389e6c85e3314bc57768d4b795e714a2e41978 |
File details
Details for the file botris_interface-0.1.21-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: botris_interface-0.1.21-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 26.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cfb1249bd1cdead1475f868460abf8d5aa930731186bcf259ab31a342b904dd |
|
MD5 | b172a6aa68a618285cfb71a5358097e4 |
|
BLAKE2b-256 | fcc67f17755fee90a0a4d6e09dead2fb667f06094ff5174435e3c56b512e8ba9 |