Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to write prolog to find the solution of the following question: 1)You have six colored balls: 4 black, 1 red and 1 blue.

I need to write prolog to find the solution of the following question:

1)You have six colored balls: 4 black, 1 red and 1 blue.

2)There are no more than 2 black balls in a row.

perm2 :- permutationQ([black,black,black,black,red,blue],[A,B,C,D,E,F]), ((A==black -> B==black), (D==black -> E==black); (C==black -> D==black), (E==black -> F==black));

this is what I thought of so far, are there more ways to go to finish the code? And which letters cannot be Red or Blue??

And I also need to calculate how many solutions exist and the conditions are:

1)Balls with the same color are indistinguishable.

2)All balls are distinct, even those with the same color.

It would be nice with explanations.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions