Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9523475

Have any Question?


Related Questions in Computer Engineering

Starting out with cpp 8th edition pg 449 7 with

Starting out with Cpp 8th edition Pg 449 #7 WITH MODIFICATIONS! Write a program that asks the user for a file name, and then ask the user for up to 100 input values. Write the user input values to the file. Then read the ...

Question project 1 involves the creation of a personal

Question: Project 1 involves the creation of a personal website for yourself - also known as a resume site or a CV site. All the files used in the website must be contained within a specific folder named "project_1" (exc ...

1 what is the boolean expression for an and gate2 what is

1. What is the Boolean expression for an AND gate? 2. What is the Boolean expression for an OR gate? 3. What is the Boolean expression for a NOT gate?

Which sentence would work better as a thesis statement for

Which sentence would work better as a thesis statement for a three-to-five-page college paper? Remember that a thesis should be a central idea that requires supporting evidence; it should be of adequate scope for essay's ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 select one of the topics listed below and discuss

1. Select one of the topics listed below and discuss it. Describe an application that you have to solve by using at least 2 Excel functions. It can be Math, Statistics, Engineering, Financial, etc. Explain what Excel fun ...

Question suppose there is exactly one packet switch between

Question : Suppose there is exactly one packet switch between a sending host and a receiving host. Assume each link has a distance 1, 250 Km with propagation speed 2.5 times 10 8 mps. Link 1 has a transmission rate 10 Mb ...

Give a recursive algorithm that generates a similar series

Give a recursive algorithm that generates a similar series of coins for changing n cents. Don't use dynamic programming for this problem.

Determine the number of moles of oleic acid in the

Determine the number of moles of oleic acid in the monolayer. Assume the nubmer of grams of oleic acid in the monolayer is  7.12×10 -6  g MW for oleic acid is 282 g/mol.

Anova labyou are interested in studying the neurological

ANOVA Lab You are interested in studying the neurological effects of dehydrogenated brominate oil, a food additive.  You randomly select 25 Sprague-Dawley rats and add a dosage to their drinking water. Because the additi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As