Zaraki Engine written in Zig

Discussion of chess software programming and technical issues.

Moderator: Ras

Timojanne
Posts: 4
Joined: Sat Mar 07, 2026 10:44 am
Full name: Timo Jokinen

Zaraki Engine written in Zig

Post by Timojanne »

Hi :)

A while ago I started getting into chess programming, writing a legal move generator in JS as my final project for school. Recently I started to pick up chess programming again and decided to write a full engine in Zig. I'm very much a beginner and I haven't worked with lower-level languages before, so this project is a challenge for me both in respect to the language and to chess programming. Nevertheless I'm at a point where I want to post about it here. All of the source code is based on the chess programming wiki, there is no novelty in regards to heuristics or algorithms but the source code is handwritten by myself.

I haven't identified the engine's current elo rating yet but it manages to win a bit more than half of games out of 1000 against Stockfish 1800 Elo.

What's included:

Board Representation
- Bitboards for piece sets
- Incremental make/unmake
- Null move make/unmake
- Incremental Zobrist hashing
- FEN parsing
- Compact 16-bit move encoding

Search
- Negamax alpha-beta
- Iterative deepening
- Aspiration windows
- Principal variation tracking
- Quiescence search with SEE Pruning, standpat
- Transposition table
- TT exact / lower-bound / upper-bound node types, always replace
- Hash move ordering
- Null move pruning
- Late move reductions
- PVS-style zero-window search on later moves
- Check extension
- Mate score normalization for TT storage
- Basic time-based stop check during node polling

Move Ordering
- Hash move
- Queen promotions prioritized
- Capture ordering with MVV-LVA
- SEE-based capture discrimination
- Killer heuristic
- History heuristic
- Selection-sort style pick-next move loop

Evaluation
- PeSTO-style tapered PST evaluation
- Middlegame / endgame interpolation by phase

You can find the source code here:
https://github.com/timojokinen/haraki-zig

I would be happy to hear the community's thoughts.
syzygy
Posts: 6030
Joined: Tue Feb 28, 2012 11:56 pm

Re: Zaraki Engine written in Zig

Post by syzygy »

Timojanne wrote: Mon Jun 22, 2026 3:34 pmbut the source code is handwritten by myself.
If that is what you did, why did you let an LLM generate this post?
Timojanne
Posts: 4
Joined: Sat Mar 07, 2026 10:44 am
Full name: Timo Jokinen

Re: Zaraki Engine written in Zig

Post by Timojanne »

I don't know what to say, I wrote the intro text myself and had the techniques and heuristics be enumerated by an llm because I was lazy. I also used AI to understand concepts better and write a README. Believe what you want
Timojanne
Posts: 4
Joined: Sat Mar 07, 2026 10:44 am
Full name: Timo Jokinen

Re: Zaraki Engine written in Zig

Post by Timojanne »

I created the first release of my engine Zaraki:
https://github.com/timojokinen/zaraki-z ... tag/v0.0.1

After fixing a bug where I mixed up endianness on PST lookup, adding very very basic eval and adding counter move heuristic, engine strength jumped to about 2500. Will register it at CCRL soon, to get a more accurate rating.

I also accepted the criticism about AI use in this thread, rewrote the README and added AI disclosure section.
OttoLau
Posts: 41
Joined: Wed Oct 22, 2025 7:10 pm
Location: Finland
Full name: Otto Laukkanen

Re: Zaraki Engine written in Zig

Post by OttoLau »

I noticed in your readme it says this:
"It uses PeSTO material and piece-square tables, mobility, a bishop-pair bonus, a simple pawn shield term, and a tempo bonus."

PeSTO is supposed to be used without any other evaluation terms (excluding tempo), as they are tuned for that specifically. So if you havent tried tuning the evaluation values with say a texel tuner to try to fit with PeSTO, they probably perform worse together.
Timojanne
Posts: 4
Joined: Sat Mar 07, 2026 10:44 am
Full name: Timo Jokinen

Re: Zaraki Engine written in Zig

Post by Timojanne »

OttoLau wrote: Thu Jul 02, 2026 12:21 pm So if you havent tried tuning the evaluation values with say a texel tuner to try to fit with PeSTO, they probably perform worse together.
Thanks. I haven’t done any tuning yet, I’ve just been using PeSTO as a baseline. My plan was to tune the eval parameters once I have a few additional basic eval features, then tune again after incorporating PSTs. That said, maybe it would be better to start from blank PSTs for the tuning step?