You Don’t Need to Be a Programmer: All it needs is a clear vision and determination.
by admin · 1 day, 1 hour ago · updated 1 day, 1 hour ago
A few years ago, building a bot that plays Chess, Breakthrough or other game meant you needed to excel in code, read a pile of documentation and lose a few weekends. Today you can describe what you want to an AI assistant and get working code back in a minute. It writes much better code when you tell it the rules of the place the code will run. This post shows what your AG Champion looks like, why it is built that way, and how to work with an AI assistant so you end up with a bot that actually plays.
What is an AG Champion?
Your AG Champion is the program, written in Python, that plays for you on the Artificial Gladiator League. The platform gives it a board position, and your file answers with a move. That’s all it does. The platform runs your file on its own servers, so you don’t host anything or keep a computer switched on.
Why the contract looks like this?
Every AG Champion has to define two functions: load(ctx) and get_move(state, fen, player). We call this the contract. If you’re new to coding it can look strange, so here is the reasoning behind it.
Two functions, because setup and play have different speeds. Getting an AG Champion ready can be slow. You might open a file, load a database or build a table. Playing a single move has to be fast. So the work is split. load runs once, when your bot starts. The method get_move runs on every turn. The platform keeps your AG Champion ready between moves, so the slow work happens once and your time during a game goes into thinking.
The variable ctx tells your code where its files are. It points to your model repo and, if you have one, your data repo. The platform never opens your files for you. You open them yourself inside load, which keeps you in control of what gets read and how.
The variable state is how load hands things to get_move. Whatever load returns, whether that’s a database, a model or a plain dictionary, comes back to you on every move as state. You don’t need tricks like global variables.
The variable fen and player are the question, and the move is the answer. The platform sends the position as text (called FEN) and which side is to move (“w” or “b”). Your bot sends back one move as a plain string, like e2e4 in Chess. It doesn’t need to track the game itself.
There is no other interface. This is on purpose. A beginner’s random-move bot and a strong neural network are called in exactly the same way, under the same limits. The platform doesn’t care how your bot thinks. Minimax, tree search, a neural network or an opening book all fit behind the same two functions, so you can use whatever idea you like.
The skeleton
Here is the shape of every AG Champion. Save it under a file name you choose, such as my_bot.py. It ends in .py and has no spaces. Then point to it from config_model.json using the “entrypoint” field.
python
NAME_OF_ALGO_FILE.py
import chess
def load(ctx):
# Runs ONCE, when your bot starts.
# ctx.model_dir -> folder with your model repo files
# ctx.data_dir -> folder with your data repo files (or None)
state = {}
# Example: read a data file here, never inside get_move.
# if ctx.data_dir is not None:
# book = ctx.data_dir / "opening_book.txt"
# if book.exists():
# state["book"] = book.read_text(encoding="utf-8").splitlines()
return state # comes back to you as "state" on every move
def get_move(state, fen, player):
# Runs on EVERY move.
# fen -> the position as text
# player -> "w" or "b"
board = chess.Board(fen)
legal = list(board.legal_moves)
if not legal:
return "" # no legal moves
# ---- your thinking goes here ----
move = legal[0]
return move.uci() # a plain string like "e2e4"
Two details trip people up. The move must be a plain string, not a list or a dictionary. And for Chess it must be in UCI notation (e2e4), not the style you might see in books, like Nf3.
Getting good code from an AI assistant
An AI can’t know how AGL works unless you tell it. Put these in your first message:
The two function names, what they receive and what they return.
The move format for your game (plain string, UCI for Chess).
The code runs with no internet. Python’s standard library plus numpy, python-chess and torch (CPU) are available.
The name of your file.
Start small. Ask for a bot that plays a random legal move and get it passing the platform’s check. Then improve it one idea at a time: prefer captures, count material, look two moves ahead. Ask the AI to explain each change in plain language. If something fails, paste the error message from the Gladiator or Diagnostics tab back to the AI together with your code, and ask for the full fixed file.
Common mistakes AI assistants make
Using the internet. Calls like requests fail, because the sandbox has no network.
Importing libraries that aren’t installed. Anything beyond the standard library, numpy, python-chess and torch fails with an import error.
Returning the wrong move format.
Reading files inside get_move. That work belongs in load.
When you spot one, tell the AI which rule it broke. It usually fixes it on the first try.
Ready to try?
Start as a guest. You can have a bot playing in about 15 minutes, with no installation and no email. Copy the starter prompt from the registration guide, save your file, paste your repo ID and play. Once it works, keep improving it, one small idea at a time.