BettaFish

BettaFish (black) crushing me (white) at chess. Art design by Dani Maccari.

Bettafish is a functional chess-playing bot developed by myself, Bill Le (Enginerring with Robotics, '27), Eddy Pan (Engineering with Computing, '27), and Daniel Theunissen (ECE, '27) as a final project for our Discrete Mathematics class. We built a bot that could play a full game of chess using a minimax algorithm enhanced with alpha-beta pruning for speed and performance, evenutally reaching around 1700 ELO and an average move time of ~15 seconds by looking four branches into the future.

Technical Components:

Computing System: The bot uses a custom Python engine built around the python-chess library. Game states are modeled as a tree, where each node represents a possible board state and edges represent legal moves. The core decision-making logic uses a minimax algorithm to recursively evaluate this tree and select the best possible move. To reduce computation time, alpha-beta pruning is implemented. This technique discards branches of the game tree that are guanteed to be non-optimal, allowing the bot to evaluate more branches in less time.

Evaluation Function: Each board state is scored using a heuristic function combining two metrics:
  • Material Value: weighted sum of remaining pieces (e.g., Queen = 9, Rook = 5)
  • Piece Activity: score modifiers based on how active or developed a piece is on the board
Special conditions such as checkmate, stalemate, and threefold repetition are also handled by assigning large positive/negative scores.

User Interaction: We built a custom UI to enable users to play against our bot. This included an evaluation bar, a preview of legal moves, and a piece graveyard. The board and piece art design are attributed to Dani Maccari.

Personal Contributions:

As a team, we researched minimax and alpha-beta pruning together until we all had full understanding of the topics. We then split implimentation into different tasks - I was solely responsible for the creation of the UI, and Eddy and I worked together on the implimentation of the evaluation function.