A complete heuristic code in C