another try of basic algo in b2.cpp