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

Explain the quantization error of an ADC, Explain the Quantization error...

Explain the Quantization error of an ADC. Ans. Quantization error- An analog voltage is within the range of 0 to 1V and for 3 bit output, the size of all intervals are

Why data bus is bidirectional, Why data bus is bidirectional and address bu...

Why data bus is bidirectional and address bus is unidirectional in most microprocessors? The data bus is bidirectional because the data bus has to transfer data among the CPU a

Operation codes used in assembly instructions, Q. Operation codes used in a...

Q. Operation codes used in assembly instructions? Now let's describe various operation codes needed for this machine so that we can translate High level language instructions t

Define memory allocation scheme in ''external'' fragmentation, The memory a...

The memory allocation scheme subject to “external” fragmentation is? Segmentation is the memory allocation scheme subject to “external” fragmentation.

Explain minimum hardware to indicate direction of rotating, The circle can ...

The circle can rotate clockwise and back. By using minimum hardware build a circuit to indicate the direction of rotating? Two sensors are required to determine the direction o

Explain the input stage of an ADC, Explain the Input Stage of an ADC. ...

Explain the Input Stage of an ADC. Ans. Input Stage- In ADC at the input stage, analog voltage can contain any value in a range although the digital output can contain

Fundamental issues of concerns for instruction set design, Q. Fundamental i...

Q. Fundamental issues of concerns for instruction set design? A number of fundamental issues of concerns for instruction set design are: Completeness: For an early design

Explain demand paging, What is Demand paging? Virtual memory is commonl...

What is Demand paging? Virtual memory is commonly executed by demand paging. In demand paging, the pager brings only those essential pages into memory instead of swapping in a

Define memory utilization factor, Memory utilization factor shall be comput...

Memory utilization factor shall be computed as? Ans. memory in use/total memory connected.

What are multi-cycle paths, What are multi-cycle paths? Multi-cycle pat...

What are multi-cycle paths? Multi-cycle paths are paths among registers which take more than one clock cycle to turn out to be stable. For illustration analyzing the de

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