coded part of base algorithm to input data and return action