---
title: "Hello Chess Friend"
description: I started building a chess engine in Rust. Here it is.
date: 2023-12-29T08:29:00-08:00
series: chess-friend
categories: Tech
tags: [Programming, Chess]
---

I started [playing a lot of chess][chess-post] recently. As often happens with
me, it wasn't very long until I started wondering how I could Do Programming To
It.

I found the mostly excellent, occasionally vague and confusing [Chess
Programming Wiki][cpwiki] and have been using that as a guide. It helpfully says
this on it's [Getting Started][cpgs] page:

> The **very first step** to writing a chess engine is to write a complete, bug
> free board representation that knows every rule of chess.

As a software engineer, the "bug free" bit cracks me up.

My engine is called ChessFriend. It uses [bitboards][cpbb] for its board
representation. As of this post, I've managed to write a board representation
that allows me to place pieces of both colors on any square, and I'm hacking
away at the move generator. I've also written a small command line "board
explorer" utility that can interact with my board representation. Of course, it
has a pile of unit tests, helping me inch ever-so-slowly toward that blissful
bug-free state.

It's written in Rust. I've [_mostly_][rust-bc-toot] avoided fighting with the
borrow checker.

[chess-post]: {{< ref "chess" >}}
[cpwiki]: https://www.chessprogramming.org/Main_Page
[cpgs]: https://www.chessprogramming.org/Getting_Started
[cpbb]: https://www.chessprogramming.org/Bitboards
[rust-bc-toot]: https://mastodon.social/@erynofwales/111637122773195611
