Optimizing Bishop, Rook, and Queen Move Generation in a Chess Engine - Aryan Naraghi - C++Now 2026 @CppNow
Optimizing Bishop, Rook, and Queen Move Generation in a Chess Engine - Aryan Naraghi - C++Now 2026  @CppNow
Uploaded August 2026 | Updated December 2026, 3 hours ago
https://www.cppnow.org​
---

Optimizing Bishop, Rook, and Queen Move Generation in a Chess Engine - Aryan Naraghi - C++Now 2026
---

A chess engine must search millions of positions per second. Move generation is often a bottleneck. Generating moves for knights, kings, and pawns are computationally cheap (~1 nanosecond). However, rooks, bishops, and queens (aka "sliding pieces") present a unique challenge: their movement depends on the placement of other pieces. This makes on-demand generation too slow (20+ nanoseconds) and naively-implemented lookup tables impractical (requiring zettabytes of RAM).

We will start by reviewing the core data structures in a chess engine and the logic behind move generation. Then, we will explore "magic bitboards", a perfect hashing technique that enables sliding piece move generation in ~1 nanosecond. We will look at how to implement this in modern C++, comparing hardware-specific instructions like PEXT (Parallel Bits Extract) against a portable software approach. Finally, we will discuss the practical challenges of generating the data structures required for magic bitboards, including the limitations of consteval and how to integrate build-time table generation into the build process using Bazel.

To ground these concepts, we will be referencing implementation details and code from my C++ chess engine, FollyChess.
---

Slides: cppnow26.follychess.com

think-cell develops one of the world’s leading PowerPoint applications, with C++ at the core of everything we build, from layout algorithms to deep integration with Microsoft Office. Interested in working on challenging C++ problems with real-world impact? Explore our open roles: think-cell.com/en/career/tech
---

Aryan Naraghi

Aryan Naraghi is a Staff Software Engineer at Google specializing in distributed systems. Over the past 14 years, he has built critical infrastructure across Google (including BigQuery, Cloud Run, Compute Engine, and Vertex AI) and previously led data strategy as Head of Data Analytics at Restaurant Brands International. He holds a B.S. in Computer Engineering from the University of Washington.

A dedicated C++ practitioner, Aryan is the creator of FollyChess, a C++ chess engine focusing on low-latency search and modern C++ design patterns.
---

C++Now is an annual onsite international C++ programming and coding conference held in Aspen, Colarado. For all C++ developers, C++ software engineers and those involved with the C++ language, CppNow provides an indepth and technical content provided by the best and brightest C++ experts of the C++ world.
Annual CppNow Conference - cppnow.org
linkedin.com/company/cppnow​
twitter.com/cppnow
facebook.com/CppNow
reddit.com/r/CppNow
https://mastodon.social/@cppnow
Video Sponsors: Bloomberg
---

Videos Filmed & Edited By Bash Films: bashfilms.com
YouTube Channel Managed & Optimized By Digital Medium Ltd: events.digital-medium.co.uk
---

#boost #cpp #cplusplus #programming #coding #softwareengineering #softwaredeveloper #code #cplusplusprogramming #cplusplustutorial #cplus #softwaredevelopment #coder #talk
Optimizing Bishop, Rook, and Queen Move Generation in a Chess Engine - Aryan Naraghi - C++Now 2026Declarative Refactoring for the Masses in C++ - Andy Soffer - C++Now 2025Mastering the Code Review Process - Boosting C++ Code Quality in your Organization - Peter MuldoonLightning Talk: Your Very Own Godbolt - Andy Soffer - C++Now 2025Co-Designing Integrated AI-Enabled Compiler-Runtime Systems - Hartmut Kaiser - C++Now 2026std::optional — Standardizing Optionals over References - A Case Study - Steve Downey - C++Now 2025Lightning Talk: Laws of Software - Richard Powell - C++Now 2025C++ on Nightmare Mode - Achieving High Performance, Cross-Platform, and Reliable Code - C++Now 2025Lightning Talk: Our Most Treacherous Adversary - James McNellis - C++Now 2026Lightning Talk: Bool - Implicitly Dangerous - Jeff Garland - C++Now 2026Embedded Asynchronous Abstraction C++ - Implementing Senders & Receivers Without an OS - Ben DeaneFive Issues with std::expected and How to Fix Them - Vitaly Fanaskov - C++Now 2025
CppNow |

Optimizing Bishop, Rook, and Queen Move Generation in a Chess Engine - Aryan Naraghi - C++Now 2026

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER