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
Ans) BEA Web Logic is a J2EE application server and also an HTTP web server by BEA Systems of San Jose, California, for UNIX, Linux, Microsoft Windows, and other platforms. Web Log

Used to interrupt CPU normal implementation routine and to get its attention .Mostly generated by an external devices, timers, counters...etc

Important points of simulations In this simulation it is essential to consider: (1)  What and how data is gathered (2)  How simulation is done (3)  How system would wo

Given a collection of DNA sequences (it can be downloaded in the assignment directory), where true binding sites as positive examples have been provided. The objective of this assi

Example of Structural hazards - computer architecture: A machine has shared a single-memory pipeline for instructions and data. As a consequence, when an instruction which con

Q. What is Single Program Multiple Data? A general style of writing data parallel programs for MIMD computers is SPMD (single program, multiple data) means all processors execu

Displaying a number Supposing that two digit number 59 is stored as number 5 in BH and number 9 in BL to convert them to equivalent ASCII we will add "0" to each one of them.

Write about TSR TPA also holds TSR (terminate and stay resident) programs which remain in memory in an active state until activated by a hot-key sequence or another event like

Q. Explain the Fetch Cycle? The beginning of every instruction cycle is the fetch cycle and causes an instruction tobe fetched from memory.   The fetch cycle comprises four

Determine the analog output voltage of 6-bit DAC (R-2R ladder network) with Vref as 5V when the digital input is 011100. Ans. The analog output for 6-bit R-2R DAC ladder network