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
Explain Excess 3 Codes Ans. Excess 3 Codes 1. This is the other form of BCD code. All decimal digits are coded in 4 bit binary code. 2. The code for all decimal di

A message is a string of bytes that has meaning to the applications that use it Message = Header(s) + Application Data A message having of a header and the attached applicat

Fifth Generation (1984-1990) The advancement of the next generation of computer systems is characterized majorly by the acceptance of parallel processing.  Until this time para

Not Recently Used Page Replacement Algorithm The not recently used abbreviated as NRU page replacement algorithm works on the subsequent principle: while a page is referenced,

Ferroelectric RAM is a random-access memory same in construction to DRAM but uses a ferroelectric layer rather of a dielectric layer to achieve non-volatility. FeRAM is one of a gr

How does a hybrid in telephone networks work ? The circuit operation is as follows: The input signal is coupled to the B and F windings similarly. By the C winding, the i

Handling Multiple Devices Interrupt Priority   Continue to accept interrupt requests from higher priority components   Disable interrupts from component at the sa

Syntax of $display and $strobe -  $display ("format_string", par_1, par_2, ... ); -  $strobe ("format_string", par_1, par_2, ... ); -  $monitor ("format_string", par_1, p

Pros and Cons of Assembly Language The following are a number of advantages / disadvantages of employing assembly language: Assembly Language offers more control over ha

Explain UDP (User Datagram Protocol). UDP utilizes a connectionless communication paradigm. It is an application of using UDP doesn't require preestablishing a connection befor