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:


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
Resolution Method - Artificial intelligence: A minor miracle happened in 1965 when Alan Robinson published his resolution function. This function uses a generalized format of t

Explain the term- Signals -  Signals are used for communication between components -  Signals can be seen as real, physical signals -  Some delay should be incurred in a

Advantages to companies adopting call centres Computer systems have allowed companies to set up call centres in other nations where potential cost savings can be made. This, of

A model for parallel programming is an abstraction and is machine architecture independent. A model can be executed on several hardware and memory architectures. There are various

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

Q. Find the average of two values? Find the average of two values which are stored in  ; Memory locations named FIRST and SECOND  ; And puts result in memory location AVG

What is meant by common control? In several switching systems, the control subsystem may be an integral part of the switching network itself. This system is termed as direct co

Multiprogramming or multitasking? Ans: The OS manages the concurrent execution of many application programs to make best possible use of computer resources. This pattern of si

Question: a) With the help of a diagram, describe clusters in cellular systems. b) Describe the role of the following components in the GSM architecture Radio Sub-Sy

Explain Anonymous FTP. Use of a login password and name helps maintain file secure from unauthorized access. Though, sometimes these authorizations can also be inconvenient.