rg(p, b) = ! ( row(p) =1 && sbf(p) =0) rp(p, b) = if ( ( ( sbf(p) >1) and (0<=row(p) <=sbf(p) -2) ) or ( ( sbf(p) =1) and (row(p) =0) ) ) then if (b=0) then BSh( sbf(p) , row(p) +1, col(p) ) else BSh( sbf(p) , row(p) +1, flip(row(p) , col(p) ) ) else if ( ( sbf(p) >1) and (row(p) =sbf(p) -1) ) then if (b=0) then BSh( sbf(p) -1, 0, col(p) ) else BSh( sbf(p) -1, 0, flip(row(p) , col(p) ) ) rb(p, ...