The aim of this paper is to consider a method for generating a crossword puzzle solution by using PROLOG and Visual BASIC, given a certain lexicon and puzzle shape. A method of optimization of PROLOG source code to accomplish this task will be also presented.