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
#question.constructors and destructors

Q. What is a DSS and Describe its components? A decision support system (DSS) is a highly flexible and interactive IT system that is designed to support decision making when t

Problem 1 (a) Explain the RAID system and explain all possible configurations. (b) Summarize design goals, features and specifications of the Linux ext2 file system. (c

Q. How to Change Default Drive in dos? To modify a default drive type the new drive letter followed by colon (:) and then press Enter.  For example, if the default drive is A a

Step 1: Click on Edit Step 2: Select reference Step 3: Select Translation Step 4: Click on SSI Step 5: For showing the SSI file; choose one of the following options:

Explain the Logic symbols - Flip Flops? These flip-flops are as well called Master-Slave flip-flops simply because their internal construction is divided into two sections. Th

At the bottom of the toolbar there is a box with two lesser boxes and an arrow. The uppermost box displays the present foreground color; the lowermost box shows the present backgro

Describe some of applications of buffer? Applications of buffer: a. They are utilized to introduce tiny delays. b. They are utilized to eliminate cross talk caused becaus

What is Read only memory (ROM) and Define the Use of it? A simple kind of ROM can be constructed from a decoder, Or gates, and a number of wires. Input

Explain the Advantages of High Level Languages? The major advantage of high-level languages over low-level languages is that they are easier to write, read, and maintain. Ultim