Cryptarithmetic problem in artificial intelligence, Computer Engineering

Assignment Help:

Solve the following cryptarithmetic problem using Prolog:

P I N G
P O N G
+ F U N
---------
I G N I P

Each of the 7 different letters stands for a different digit. The aim is to find a substitution of digits for the letters such that the resulting sum is arithmetically correct. Your program should find ALL answers, that do not have leading zeros.

It should be possible to query your solution in this manner:

?- crypt(P,I,N,G,O,F,U).

Your solution should then produce all of the combinations of the digits that satisfy the addition problem above. Don't get
confused between the letter "O" and the number "0" (zero).

HINT - use generate-and-test.

HINT - make sure you never let P=N, or G=F, etc... all of the
distinct letters have to stand for distinct digits.

2. Assume that you have a set of facts about airline flights in the following format:
flight(Number,Source,Dest,Leaves,Arrives).
for example:
flight(22,la,ny,10,15).
means that flight #22 leaves "la" at 10am and arrives
in "ny" at 3pm (assume a 24-hr clock, integers only).

Write the following rules:

-- long(Number,Time)
is true for flights which are in the air longer than Time.
-- route(Source,Dest)
is true for each pair of cities for which there is some sequence of flights starting at Source and ending at Dest.
(it doesn't have to display the route, just be true if there is a route).

You may assume that all flights are completed within the 0-24 time period.... that is, you DON'T have to worry about flights
which arrive after the clock "wraps around" back to zero.
The best solutions are queryable.


Related Discussions:- Cryptarithmetic problem in artificial intelligence

What is segment directive, Q. What is SEGMENT Directive? Segment direct...

Q. What is SEGMENT Directive? Segment directive defines logical segment to which following instructions or data allocations statement belong.  It also provides a segment name t

What is link destruction, What is link destruction? Link destruction is...

What is link destruction? Link destruction is inverse of link creation. When a link is destroyed makes sure the associated objects accessible by other handles or intentionally

Explain about the term- reports, Explain about the term- Reports Repor...

Explain about the term- Reports Reports are produced as a result of questions like "how many times has a type of car broken down" or "which cities have the highest house price

Which of the logic gates are known as universal gates, Which of the logic g...

Which of the logic gates are known as universal gates ? Ans. NAND and NOR are termed as universal gates, since any digital circuit can be realized completely by using either of

Identify the fastest logic gate, Which of the following is the fastest logi...

Which of the following is the fastest logic ECL, TTL, CMOS or LSI ? Ans. The fastest logic is ECL.

What is fork swap, What is Fork swap? "Fork ()" is a system call to mak...

What is Fork swap? "Fork ()" is a system call to make a child process. When the parent process calls "fork()" system call, the child process is formed and if there is short of

Illustrate what is universal law of universal gravitation, Q. Illustrate wh...

Q. Illustrate what is the universal law of universal gravitation? Answer:- Declaration that any particle of matter in the universe attracts any other with a force varying

Syntax and semantics - first-order logic, Syntax and Semantics: Propos...

Syntax and Semantics: Propositional logic is prohibited in its expressiveness: so just to represent true and false facts for the world. By a type of extending propositional lo

Define main memory and auxiliary memory, Define main memory and auxiliary m...

Define main memory and auxiliary memory? The memory unit that communicates directly with the cpu is known as main memory [RAM].Devices that give backup storage are known as aux

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd