N queens problem in Prolog

2020-01-10 | #Constraint programming #prolog

Below the N Queens problem solved in Prolog and Constraint Logic Programming over Finite Domains library :- use_module(library(clpfd)). n_queens(N, Queens) :- length(Queens, N), Queens ins 1..N, all_different(Queens), %% the queens must be in different columns different_diagonals(Queens).

Continue reading 