Prolog for Competitive Programming

CodeChef is distinguished in having Prolog among the available programming languages in its automatic judge system for competitive programming and problem solving. However, I noticed that the following sample solution for Prolog code does not identify explicitly the specific requirement for submitted Prolog code.

Prolog Sample Solution

In particular, the automatic judge requires that the entry point of the solution is predicate program/0. The following are sample accepted Prolog solutions.

1. ATM

2. Life, the Universe, and Everything

3. Factorial

Lines 3-22 in these accepted submissions include helper predicates for reading input data from the standard input stream.

CodeChef automatic judge uses presently version 7.2.3 of the free SWI-Prolog compiler, whose documentation is available online. The automatic judge returns a compilation error message if the submitted Prolog code does not include predicate program/0.

Learn Prolog Now is a good source for life-long learners who wish to learn about Prolog.