{"content":{"sharePage":{"page":0,"digests":[{"id":"64439740","dateCreated":"1382230153","smartDate":"Oct 19, 2013","userCreated":{"username":"vladpetric","url":"https:\/\/www.wikispaces.com\/user\/view\/vladpetric","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"},"monitored":false,"locked":false,"links":{"self":"https:\/\/chessprogramming.wikispaces.com\/share\/view\/64439740"},"dateDigested":1531475774,"startDate":null,"sharedType":"discussion","title":"Demystifying the Magic Multiplier?","description":"Hi everyone,
\n
\nMy name is Vlad, I'm new to this site and I'm also an Othello dude. While working on an Othello project, unaware of all the good work done here, I essentially rediscovered the magic bitboard trick :) (mask, multiply, shift).
\n
\nHowever, I came to the same conclusion from a different angle. I looked at how multiplication works, and I was able to determine the multipliers in a straightforward manner - no need for brute force, just a direct algorithm.
\n
\nWould you mind taking a look at my writeup?
\n
\nhttp:\/\/drpetric.blogspot.com\/2013\/09\/bit-gathering-via-multiplication.html<\/a>
\n
\nI have no idea if this is original, but at the very least it seems to improve on the brute force finding.
\n
\nThank you!","replyPages":[{"page":0,"digests":[{"id":"66269904","body":"Hi Vlad,
\n
\nwelcome to cpw and thanks for sharing your writeup on magic multiplication. I am not yet entirely sure I understand your bit gathering correctly - whether you are able to analytically find magic multipliers to process two lines (i.e. file and rank, or both diagonals of a square) in one and-mul-shift-run? With two lines, many intermediate overflows may occur in multiplication, which is the issue in brute force searching for magics bitboards, likely with some initial guessing, i.e lowest bit set, highest bit set, number of bits, etc.. The second issue is to reduce the index range for attack-sets - there is not necessarily a bijective but surjective mapping from masked two-line occupancies to an occupied-index, where different redundant outer occupancy-bits "behind the first blocker" in each of up to four ray-directions, and therefor equal attack-sets, may share the same index.
\n
\nSingle-line multiplication is further elaborated in
\n