Idiomatic way to allocate memory for bitfields

Yes, bit_set is the way to go (unless you have a maximum board size 10*10).

For any size, provided at runtime, use std.bit_set.DynamicBitSet.
An allocator is needed on initialization.
e.g.

var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const gpa_allocator = gpa.allocator();

var board = try std.bit_set.DynamicBitSet.initEmpty(gpa_allocator, 12*12);

board.set(12);   // set 1 to bit no 12
board.unset(12); // set 0 to bit no 12
3 Likes