Question: I need help with the programming assignment it in the prologue and I never used a prologue before For this assignment, you will submit a

I need help with the programming assignment it in the prologue and I never used a prologue before

For this assignment, you will submit a single .pl file containing your Prolog program. Include a report file with input/output samples of your program.

Hint

Write color/1 predicate indicating the 4 colors (you may name them red, yellow, green, blue or any 4 different colors).

Write the different/2 predicate indicating how 2 colors are different.

Write coloring/2 predicate, any coloring must be complete and valid. So you will write 2 different predicates to ensure these 2 properties.

For example, the predicate to ensure completeness will just go over the first list and add paint(X,_) for each element in the list [X|T] and ensure completeness of the remaining items T using recursion. There should be a base case stating that if both lists are empty in the graph [[][]] then an empty assignment is an empty list as well [].

The predicate to ensure the validity of assignment M should make sure if X is adjacent to Y then X and Y are given different colors in assignment M. To ensure this you may have to look for assignments of X and Y separately in the assignment list M using a different predicate ( assignment(X,M,Xc) should tell you what color X is assigned in the list of assignments M)

These assignments should have very few lines of code. If you have any questions, please ask during class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!