Working with bitboards, bit words, binary, not sure?

sprintf (alias format) returns a formatted string, whereas printf
outputs a formatted string. printf('%08b', 0b1) is the same as
print(sprintf('%08b', 0b1)).

As to the conversion:

You don't really have to "convert" the numbers for the bitboard to work.
All the calculation is done directly on integers and has nothing to do
with how these integers are represented. So instead of writing 0b1100 &
0b1010, you might as well write 12 & 10, which is exactly the same.

You'll need the (s)printf only for displaying the bitboard. So it's
probably best to use it in the to_s method of the class:

class BitBoard
...
  def to_s
    format '%064b', @underlying_integer
  end
...
end

···

--
Posted via http://www.ruby-forum.com/.