next up previous index
Next: Basic Control Up: Starting with Grace Previous: Starting with Grace

Program Source Modifications

To use Grace on this program, we have to load the Grace library and to insert calls to Grace predicates into the program source, resulting in queensg.pl:

:- lib(grace).                                 % Grace
queens(N, List) :-
    grace_start(queens),                       % Grace

    % Define variables and their domains
    length(List, N),
    List :: 1..N,
    grace_matrix(List, queens),                % Grace

    % Constraints
    %2
    alldistinct(List),
    %3
    constrain_queens(List),

    % Label the variables
    grace_label.                               % Grace

When we now call queens(8, L), we will see the following happen:



Micha Meier
Tue Jul 2 10:07:34 MET DST 1996