Question: Write predicates that will find solutions for the following colored-balls-in-a-row problem with different sets of constraints. You have six colored balls: 2 black, 2 red
Write predicates that will find solutions for the following colored-balls-in-a-row problem with different sets of constraints.
You have six colored balls: 2 black, 2 red and 2 blue.
No balls of the same color may be adjacent to one another.
Write Prolog predicates to find all solutions for that situation (i.e. if you force recursion with ;, Prolog will find the next solution, and the next, until it has found them all, and then it will fail).
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
