You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/bot-development.md
+47-10Lines changed: 47 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This guide teaches you how to create custom bots for Balatro using the Balatrobo
6
6
7
7
Balatrobot allows you to create automated players (bots) that can play Balatro by implementing decision-making logic in Python. Your bot communicates with the game through a socket connection, receiving game state information and sending back actions to perform.
8
8
9
-
A bot is essentially a Python class that inherits from the `Bot` base class and implements specific methods that get called at different points during gameplay. The framework uses a modern **ActionSchema** API that returns structured dictionaries instead of plain lists, making the code more readable and type-safe.
9
+
A bot is essentially a Python class that inherits from the `Bot` base class and implements specific methods that get called at different points during gameplay. The framework uses an **ActionSchema** API that returns structured dictionaries, making the code readable and type-safe.
10
10
11
11
## Key Concepts
12
12
@@ -15,6 +15,49 @@ A bot is essentially a Python class that inherits from the `Bot` base class and
15
15
-**Actions Enum**: Predefined action types your bot can perform
16
16
-**Type Safety**: Modern Python type hints ensure your bot is robust and maintainable
17
17
18
+
## Development Environment Setup
19
+
20
+
The Balatrobot project provides a complete development environment with all necessary tools and resources for building bots.
21
+
22
+
### Bot File Location
23
+
24
+
When creating new bots, place your files in the `bots/` directory using one of these recommended patterns:
25
+
26
+
-**Single file bots**: `bots/my_new_bot.py`
27
+
-**Complex bots**: `bots/my_new_bot/main.py` (for bots with multiple modules)
28
+
29
+
Both approaches are considered best practices and allow for easy organization and discovery of your bot implementations.
30
+
31
+
### Pre-configured Development Environment
32
+
33
+
The project comes with a fully configured Python development environment:
34
+
35
+
-**Python Virtual Environment**: Pre-installed with the balatrobot package and all dependencies
36
+
-**Code Quality Tools**: Linting, type checking, and formatting configured in `pyproject.toml`
37
+
-**Continuous Integration**: Working CI pipeline ensures code quality standards
38
+
39
+
### Available Documentation and Resources
40
+
41
+
The repository contains extensive documentation and reference materials:
42
+
43
+
-**Comprehensive API Documentation**: Complete guides for bot development and API usage
44
+
-**Steamodded Wiki**: Included as a git submodule (clone with `--recurse-submodules` for LLM-friendly context)
45
+
-**Source Code Access**: Full balatrobot Python source code and Lua implementation for reference
46
+
-**Example Implementations**: Working bot examples to learn from and build upon
47
+
48
+
!!! tip "Enhanced LLM Development Experience"
49
+
This rich documentation ecosystem is particularly beneficial when working with Large Language Models (LLMs) for bot development. The complete source code, comprehensive documentation, and Steamodded wiki provide extensive context that helps LLMs understand the framework and generate more accurate, contextually-aware code suggestions.
50
+
51
+
### Getting Started
52
+
53
+
To begin developing your bot:
54
+
55
+
1. Navigate to the `bots/` directory
56
+
2. Create your bot file using the recommended naming convention
57
+
3. Use the existing Python environment (balatrobot is already installed)
58
+
4. Leverage the code quality tools and CI pipeline for professional development
59
+
5. Reference the extensive documentation and source code for guidance
60
+
18
61
## Creating Your First Bot
19
62
20
63
Let's examine a complete example bot to understand how to implement your own:
@@ -106,7 +149,7 @@ if __name__ == "__main__":
106
149
107
150
## ActionSchema Format
108
151
109
-
The new API uses a consistent format for all actions:
152
+
The ActionSchema API uses a consistent format for all actions:
110
153
111
154
```python
112
155
# ActionSchema structure
@@ -160,9 +203,6 @@ def __init__(
160
203
161
204
All bot methods receive an `env` parameter containing the current game state. The game state contains all information about the current situation, including cards in hand, jokers, consumables, blind information, and more.
162
205
163
-
!!! note
164
-
For detailed information about the game state structure, see the [Game State Reference](game-state.md) page.
165
-
166
206
**skip_or_select_blind(env)**
167
207
168
208
Called when the bot needs to choose whether to skip or select a blind.
0 commit comments