Example of prolog, Computer Engineering

Example of Prolog:

We can say that this is also true if there are four even numbers. Now we have our first rule:

• If there are three or four even numbered cards, such player one should choose the highest even numbered card in their first go probably.

Whenever there are three or four odd cards it's not difficult to see that the most rational action for player one is to choose the highest odd numbered card:

• If there are three or four odd numbered cards, such player one should choose the highest odd numbered card in their first go. The only other situation is when there are two even and two odd cards. However, this case, I'll leave it as an exercise to convince yourselves that there are no rules governing the choice of player one's first card: they can simply choose randomly, it means that they're not going to win unless player two makes a mistake.

Just to write an expert system to decide what type card to choose in a game, that we will require to translate our rules into first-order logic, then into a Prolog implementation. Now in our first rule states such in a game, eg:

2395_Example of Prolog.png


There is the meaning of the predicates is as obvious as it seems. Correspondingly our second rule can be written like:

2147_Example of Prolog1.png


So there are many different ways to encode these rules as a Prolog program but different implementations will differ in their execution time. Just for our simple program, there it doesn't truly matter that predicates we choose to implement. If we will make our top level predicate as:

player_one_chooses/2.

Than the predicate will take a list of card numbers such the first argument, it will choose a member of this list to put as the second argument. In fact in this way, there the same predicate can be used in order to make second choices.

Posted Date: 1/10/2013 6:01:04 AM | Location : United States







Related Discussions:- Example of prolog, Assignment Help, Ask Question on Example of prolog, Get Answer, Expert's Help, Example of prolog Discussions

Write discussion on Example of prolog
Your posts are moderated
Related Questions
the counter shown Q2Q1Q0=000 The status of Q2Q1Q0 after the pulse

Server can interact with more than one client with using threading concepts there are java threads which are allocated to each client when he logs in to server, the thread handles

Q. Observations of High Level Language Program? Observations Integer constants appeared nearly as frequently as structures or arrays. Most of the scalars were foun

a) Write a program that figures out how long it will take to pay off a credit card by making payments of $10 every month. Take care to avoid infinite loops. (How would a bank preve

Explain at least one modulation technique used for high speed modems. FSK - Frequency Shift Keying: In such technique the frequency of the carrier signal is changed as per to

In MS Access, the long and short date option does not show 4 digit years. How do I achieve the mm/dd/yyyy format? Ans) In the date field properties of the table, form, or prop

Define the term- encryption The user would then type in O P E and card purchase will be authorised. This extra protection is used as well as encryption. Some of the new syste

In binary counter the flip flop of lowest order position is complemented with each pulse. This means that JK input position must be maintained with logic one

IS strategy - Information System As an operations manager when attempting to navigate your organisation through the information landscape and make best use of the available sy

MANAGERIAL BENEFITS Implement integrated reliability engineering and product assurance program in all aspects of the product life-cycle, covering purchase, engineering, R&D