M42 - C++ Library for Bitboard Attack Mask Generation

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
vittyvirus
Posts: 646
Joined: Wed Jun 18, 2014 2:30 pm
Full name: Fahad Syed

M42 - C++ Library for Bitboard Attack Mask Generation

Post by vittyvirus »

GitHub

It's something I wrote years ago and haven't touched since.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: M42 - C++ Library for Bitboard Attack Mask Generation

Post by Sven »

Thanks for making this public!
For sliders the readme says:
These functions take the square of the piece as their first argument (a1 = 0, a2 = 1, …, h8 = 63)
but I guess it should be:
a1 = 0, b1 = 1, ..., h8 = 63
according to the source code. Right?
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: M42 - C++ Library for Bitboard Attack Mask Generation

Post by dangi12012 »

M42 looks very cool - and I will add it to this list under the name SBAMG if its ok with you.
https://github.com/Gigantua/Chess_Movegen
Will update it to C++20 and constexpr initialisation (which helps)
If the algo looks fast I will also add a version without lookups and add it to the CUDA version.

Good ideas - this one speaks volumes and you found some good optimisations in 2015:
http://www.talkchess.com/forum3/viewtopic.php?t=56804
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
osvitashev
Posts: 6
Joined: Tue Sep 07, 2021 6:17 pm
Full name: Olexiy Svitashev

Re: M42 - C++ Library for Bitboard Attack Mask Generation

Post by osvitashev »

I played with M42 as well and liked the functions which are exposed as well how minimalist it is.
Ultimately, i ended up using https://github.com/kz04px/libchess instead, as it is a bit more feature-rich