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 primary aims/details of Load Sharing Facility Resource Management Software(LSFRMS) are good resource utilization by routing the task to the most appropriate system and good uti

Odd-Even Merging Circuit Let's firstly understand the idea of merging two sorted sequences using an odd-even merging circuit. The functioning of a merging circuit is as given b

Case Study - A taxi company has 200 taxies. The company provides its services to all the nine districts in Mauritius, about 20 taxies per district. A taxi is normally attached to

Draw and illustrate the block diagram of DMA controller. Also discuss the various modes in which DMAC works. Direct memory access (DMA) is a process in that an external device

Could TCP allow IP to checksum the data? TCP cannot permit IP to checksum data yet IP has its own checksum for its header. IP layer is fundamentally responsible for routing of

Q What do you mean by Directives? Assembly languages support numerous statements. This allows you to control the way in which a source program assembles and list. These stateme

haw to convert context free grammar to regular grammar

Q. What is control function? If transfer is to take place only under a predetermined control condition then this condition can be specified as a control function. For illustrat

Problem (a) Explain the difference between the real mode and the protected mode in the 80x86 family of processors. (b) The 32-bit physical address 047C:0048 is to be conv

Q. Fundamental differences between RISC and CISC architecture? Fundamental differences between RISC and CISC architecture. The following table lists following differences: