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
Levels Of Parallel Processing Depending upon the difficulty under consideration, parallelism in the answer of the problem may be achieved at dissimilar levels and in different

How semaphores implement mutual exclusion? Mutual-exclusion implementation along with semaphores: Assume that there are n-processes and they share a semaphore, mutex (stan

How can you show only selected records with a form? There are dissimilar ways in which you can limit the records that you will see with a form, you can: Open a form and app

Q. Define pvm library functions? int info = pvm_freebuf( int bufid ) organizes of a message buffer. bufid message buffer identifier.  int pvm_getsbuf( void

Illustrate about Sharing of Structure and Behaviour  One of the reasons for the popularity of object-oriented techniques is that they promote sharing at different levels. Inher

Design a 4 : 1 multiplexer with strobe input using NAND gates. Ans. Design of 4 : 1 multiplexer with strobe input using NAND gates.

Q. Illustrate Internal Organisation of RAM? The construction displayed in Figure below is made up of one JK flip-flop and 3 AND gates. The two inputs to system are one input bi

The addressing specially used by Transport Layer is? The addressing particularly used through transport layer is application port address.

Step 1: Choose File -> Import XML into Template Step 2: Select the XML file & click Open When an XML file is imported, Dreamweaver merges XML content in Template, which is be

Terms in Propositional model: There in first-order logic allows us to talking about properties of objects that the first job for our model (Δ, Θ) is to assign a meaning to the