Answer to Question #31862 in Prolog for Alihuseyn

Question #31862
In this assignment, you are expected to implement a solution in Prolog to the N-Tiles Problem.N-Tiles
problem is problem of placing N copies of a tile T (TX/TY) on an SxS square grid so that no two copies
touch each other. Namely, N-Tiles problem takes three inputs:
• S: Grid Size
• N: Number of copies to place
• T : Tile definition in (TX,TY) form.
and produces an N-sized set of points on the grid satisfying the non-touching condition.

A call to ntiles predicate should fail if there exists no solution for the problem specified with parameters.
Below is given examples for a no-solution case and a case with 4 different solutions.
>ntiles(2/1,3,3,P).
No

>ntiles(2/1,3,2,P).
P=[1/1,1/3]?;
P=[1/1,2/3]?;
P=[2/1,1/3]?;
P=[2/1,2/3]?;
No.
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS