prolog written for various assignments