Skip to main content

Command Palette

Search for a command to run...

Building RoastChess: A Trash-Talking Chess AI in the Terminal

Published
4 min read
Building RoastChess: A Trash-Talking Chess AI in the Terminal

I’ve been working on a chess engine that doesn’t just play decent chess, but also roasts you while doing it.​
The result is RoastChess – a terminal-based chess bot written in Python with its own personality, a custom Minimax engine with Alpha-Beta pruning, and an evolutionary training setup.​


Why I Built RoastChess

I love projects that sit at the intersection of algorithms, game design, and a bit of chaos. RoastChess started as a simple chess engine experiment and gradually turned into:

  • A way to understand search algorithms (Minimax + Alpha-Beta).​

  • A sandbox to play with evolutionary training and weight tuning.​

  • A fun terminal app that feels more like a cocky friend than a quiet engine.​

Instead of yet another silent chess bot, I wanted something that reacts to bad blunders, comments on your choices, and feels “alive” despite running in a terminal window.​


Core Features

RoastChess is designed to be both playful and technically interesting.​

  • Pro dashboard UI: A hacker-style terminal dashboard built with rich, with split panels for the board, chat/roasts, and move history.​

  • Trash-talking persona: The engine comments in real time on your play, giving you playful jabs when you blunder.​

  • Custom engine: A hand-built Minimax engine with Alpha-Beta pruning instead of using a ready-made engine.​

  • Evolutionary training: A small “training gym” that lets the bot adjust piece weights and improve over time.​

The goal is not to beat Stockfish, but to create a human-ish, entertaining opponent that keeps games engaging.


Under the Hood: Engine and Architecture

The project is structured around a clean separation of concerns.​

  • main.py: Entry point that wires UI, engine, and personality together.​

  • src/: Core logic – engine, UI, and personality system.​

  • scripts/: Extra tools for running bot vs bot matches and training experiments.​

  • model.json: A JSON file where the bot’s learned weights and rating are stored.​

For the chess logic, RoastChess uses the python-chess library for board representation and move generation, while the decision-making layer is my own Minimax + Alpha-Beta implementation.​
This setup lets the engine explore possible move trees efficiently and prune obviously bad branches, which is essential once you increase search depth.​

On top of that, the personality system hooks into evaluations and game events (like blunders, missed tactics, or big swings) to generate fitting trash-talk lines.​


Terminal UI: Hacker Dashboard Experience

The UI uses the rich library to render a more modern terminal experience rather than a plain text dump.​

The dashboard includes:

  • A visual board view updated each move.​

  • A chat-like panel where the bot reacts and roasts.​

  • A history/log area to track moves and game flow.​

You run everything from the terminal, but it feels closer to a lightweight TUI app than a simple script.


How to Run RoastChess

If you want to try it locally, setup is straightforward.​

Prerequisites

  • Python 3.x installed.​

  • Install dependencies:

bashpip install python-chess rich

Start a Game

Run:

bashpython main.py

You’ll then:

  • Select difficulty (search depth 1–5).​

  • Choose your side (White, Black, or just watch as Spectator).​

  • Pick the bot’s personality.​

From there, play directly from the terminal and enjoy (or suffer) the commentary.


Bot Arena: Engine vs Engine Battles

RoastChess also includes a “bot arena” mode so you can watch engines fight it out.​

Run:

bashpython scripts/arena.py

This is useful if you:

  • Want to observe how different settings or personalities perform.​

  • Just feel like watching AI vs AI chaos without playing yourself.​


Training Gym: Let the Bot Evolve

One of the most fun parts of the project is the training gym.​

Run:

bashpython scripts/train.py

This script runs training sessions to adjust the engine’s piece valuation weights and improve its strategy over time.​
Progress is stored in model.json, which tracks the bot’s learned weights and rating so training isn’t lost between runs.​


Tech Stack

  • Language: Python.​

  • Libraries: python-chess for the game logic, rich for the UI.​

  • Architecture: Custom Minimax engine with Alpha-Beta pruning, personality system, and evolutionary training scripts.​

The entire project is open source and currently 100% Python.​


What’s Next

Some directions I’m considering:

  • Stronger evaluation heuristics and more nuanced positional understanding.

  • More personalities with distinct “styles” of trash talk and play.

  • Better training pipelines and analytics around model.json evolution.​

If you have ideas for wild personalities, new training schemes, or UI upgrades, feel free to open an issue or fork the repo.​


Try It Yourself

If you want to play against a chess bot that doesn’t just beat you quietly but talks back, check out RoastChess on GitHub:
https://github.com/I-invincib1e/Chess-P

You can clone it, tweak the engine, write your own personality scripts, or extend the training arena.​