r/ComputerChess • • Feb 15 '20

Introducing Surge, a fast bitboard-based move generator written in C++!

Over the past few months, I've been developing a fast purely legal chess move generator as my first major project in C++. It uses:

  • Magic Bitboard sliding attacks

  • Make-Unmake Position class (inspired by Stockfish)

  • A completely original legal move generation function

  • 16-bit move representation

The best part is that perft(6) and perft(7) from the starting position clock in at an impressive ~200,000,000 million NPS on my system (about the same as qperft, but a lot more readable)

I am planning to incorporate this in a fully functional chess engine. I'd love it if you guys could check it out at https://github.com/DiehardTheTryhard/surge. Thanks :)

12 Upvotes

3 comments sorted by

1

u/hyahh Feb 17 '20

200 million is really impressive but I've found that so many things go into a chess engine that are orders of magnitude more important than raw move generation speed. I think for a lot of chess engines the time spent generating moves is like 5% so even with infinitely fast move generation you will only end up searching a tiny fraction of a ply deeper.

1

u/Stringhe Feb 17 '20

And speed itself only really counts once you've done all the (many) basic pruning/deepening strategies (move ordering, quiescence search, LMR, futility pruning, null move pruning, ...) and have a very decent evaluation function

1

u/candidate_master Mar 12 '20

FYI, In the fen string, there's a missing space before the en passant square:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkqe3

Also the en passant square should be "-" when there's no legal en passant.