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
Determine the layout of the specified cache for a CPU that can address 1G x 32  of memory.  show the layout of the bits per cache location and the total number of locations.  a)

to find the area under curve

Explain the Client-Server Interaction Using Messages As we have learned, client- server interaction may be managed in many ways. A message- based interaction is perhaps the bes

applications of context free grammar

Explain the Programmable ROM (PROM) - Computer Memory? This is a kind of ROM that can be programmed using special equipment it can be written to, but only once and this is usef

Most interactive products aim to satisfy a variety of usability and user experience goals. Fully satisfying all of these goals is rarely, if ever, feasible, either because of pract

Q. Demonstration of sorting problem? The term sorting implies organising elements of a provided set of elements in a specific order i.e. descending order / ascending order / al

Java bean is a reusable component, where as the servlet is the java program which extends the server capability.

Autonomous Rational an Agents: In many cases, it is inaccurate to talk about a single program or a single robot, as the multi-purpose and multi-tasking system of hardware and

Polymorphism in C++ is the idea that a base class can be inherited by various classes. A base class pointer can point to its child class and a base class array can store dissimilar