Firstly, the clp(fd) documentation mentions: In modern Prolog systems, arithmetic constraints subsume and supersede low-level predicates over inte ...
Firstly, the clp(fd) documentation mentions: In modern Prolog systems, arithmetic constraints subsume and supersede low-level predicates over inte ...
I have a prolog rule position_that_is_equals_to_two that sets X to the position at which the number 2 was found in the provided list of three elements ...
This code is giving me this error in line 2 (Vars in 1..3,): ERROR: c:/users/xxxx/desktop/prolog/tp2.pl:2:20: Syntax error: Operator expected ...
I'm trying to implement a sudoku-like puzzle solver that involves groups in prolog, and where one of the rules is that the same value cannot be repeat ...
I have been trying to modify the sudoku solver available in the clpfd docs in order to solve greater-than sudoku puzzles, such as this one: Example o ...
The expression above does not terminate when posted on the swi prolog terminal. I have tried exchanging the order of goals. and I am using SW ...
I am new to Prolog, and I am writing a program to enumerate the binary trees in Prolog. Here is my program: However, I keep getting on line 3 at ...
Suppose, we have the following game: There is a pair of numbers (x, y), 2 players are making moves. During the move a player can increase any number ...
I am using constraint logic programming and I want to output a list with the product of the list (excluding the first element) is equal to the first e ...
lets say that L is L = [[1,100,_], [200, _,94]]. I have a code where I use append(List, L), L ins 1..90, ....... L ins 1..90 is false because there ...
I have been trying to learn prolog but I am having issues with limiting the possible integers that can be used in my solutions. For example, In my SWI ...
Here are 4 different ways of computing list length in Prolog: list_length1 - mathematically straightforward, works in all directions list_leng ...
I wrote this code to solve the map coloring problem using prolog: I try to get solutions using the query: but I always get the error "Arguments ...
I am trying to convert a list of integers to a CLPFD domain. e.g. [1,5,7] -> 1\/5\/7. I tried reading the documentation, but I couldn't find anythi ...
I'm learning Prolog by doing the Advent of Code challenges. Spoilers for Advent of Code 2021 day 7 below: The objective is: given a list of natural ...
Can Prolog solve this puzzle with CLP(FD)? I see some problem doing it with CLP(FD), since fractional cakes could be needed: Edward is on his way ...
Given a list of possible summands I want to determine which, if any, can form a given sum. For example, with [1,2,3,4,5] I can make the sum of 9 with ...
So I've tried to make my item_list_itemCount relation the most general possible and it indeed works, at least until a certain point. Here's the code: ...
So all of my tree code is not working properly when I instantiate my integer variables. Here's an example of what I mean: I'm not actually using th ...
So, my goal is to make a map colourer in Prolog. Here's the map I'm using: And this are my colouring constraints: Where [A,B,C,D,E,F] is a list ...