Question: write the following as prolog rules: Implement a rule crypto that solves the following cryptarithmetic multiplication problem: TOCK * TOCK = GRIPTOCK Each of the

write the following as prolog rules:

Implement a rule "crypto" that solves the following cryptarithmetic multiplication problem: TOCK * TOCK = GRIPTOCK Each of the 4 letters (T,O,C,K) stands for a different digit. The 4 letters (G,R,I,P) can each be matched by any digit. The aim is to find a substitution of digits for the letters such that the above stated product is arithmetically correct. Your program should find all answers. It should be possible to query your solution in this manner: ?- crypto(G,R,I,P,T,O,C,K). Your solution should then produce all of the combinations of the digits that satisfy the multiplication problem above.Don't get confused between the letter "O" and the number "0" (zero). Make sure you never let T=C, or C=K, etc... all of the distinct letters T,O,C,K have to stand for distinct digits.

Use generate-and-test!

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!