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 use of structures with pointers., Explain the use of structures...

Explain the use of structures with pointers C permits a pointer to a structure variable. In fact a pointer to a structure is same to a pointer to any other variable. The pointe

Define the identifiers of c language, Define the Identifiers of c language?...

Define the Identifiers of c language? In C the names of the functions, variables and arrays and various other user - defined items are called identifiers. The first character o

Show the example of internet address, Q. Show the example of internet addre...

Q. Show the example of internet address? The following can be a typical person understandable address on Internet: VVS @ expertsmind.us VVS is an username which in gene

Explain the significance ipv6 over ipv4, Explain the significance IPV6 over...

Explain the significance IPV6 over IPV4. The maximum size of an Ipv6 datagram is 65575 bytes, with the 0 bytes Ipv6 header. Ipv6 also describe a minimum reassembly buffer size:

Universal serial bus - computer architecture, Universal Serial Bus - comput...

Universal Serial Bus - computer architecture: USB   Universal Serial Bus   Speed Low-speed(1.5 Mb/s) High-speed(480 Mb/s) Full-speed(12 Mb/s)   De

What is master clock signal in control unit, Q. What is Master Clock Signal...

Q. What is Master Clock Signal in Control Unit? The Master Clock Signal: This signal causes micro-operations to be executed in a square. In a single clock cycle either a single

Cryptography, 1. Consider the one-time pad encryption scheme to encrypt a 1...

1. Consider the one-time pad encryption scheme to encrypt a 1-bit message m, and assume m is chosen with uniform distribution from message space M={0,1}. Let E1 be the event "messa

Write the program to use arrays, In class SlotCollection, remove the fields...

In class SlotCollection, remove the fields slot1, slot2, slot3 and slot4 and replace them by an array of slots. Modify the rest of the program to work using this array. There is

RS232C schematic diagram, Can someone provide me a scehmatic diagram of RS2...

Can someone provide me a scehmatic diagram of RS232C with explanation?

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