fb
fw
f
b = 2 + pb + fb - fw = 2 + pb + f w = 2 + pw + fw - fb = 2 + pw - f
pb = (b + w - 4 + 1) // 2 pw = (b + w - 4) // 2