chip distribution: implemented

used the beforehand written functions and implemented the
calculating and handing out of the previously sorted chips.