Comment

Comment by cabirum

Piece type and color fit in 4 bits.

So, either a fixed-length encoding of the whole board, 64 * (4 bits) = 256 bits = 32 bytes.

Or, sparse variable length encoding of pieces only, 6 bits to index each of 64 squares, = 10 bits * piece count. E.g. initial position takes 32*10 = 320 bits or 40 bytes.

parent cabirum 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton