Example of prolog, Computer Engineering

Assignment Help:

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.


Related Discussions:- Example of prolog

Determine the term- files, Determine the term- Files File maintenance i...

Determine the term- Files File maintenance is significant. Updating of files generally involves inserting, amending and deleting data. Example: A bank would amend data

Prolog artificial intelligence , 1. countdown Example: countdown(5,[5,4,3,2...

1. countdown Example: countdown(5,[5,4,3,2,1]).  NOTE - your function should be able to answer questions such as: ?- countdown(5,L).  2. count_occur Example: count_occur(7,[5,2,6

Real life business subsystems, Real Life Business Subsystems A Subsyst...

Real Life Business Subsystems A Subsystem is a component of a System even though it can also be described as a system in its own right. Consider a manufacturing firm. It compr

What are the event key words in interactive reporting, What are the event k...

What are the event key words in interactive reporting? Event Keyword                                                 Event AT LINE-SELECTION         Moment at which the u

Define elimination of common sub expression, Explain Elimination of common ...

Explain Elimination of common sub expression during code optimization An optimizing transformation is a regulation for rewriting a segment of a program to enhance its execution

Select-options and parameters statement, The fields specified by select-opt...

The fields specified by select-options and parameters statement cannot be grouped together in the selection screen.  No, It can be grouped together in the selection screen

What is computer motherboard, If you open your computers case, the motherbo...

If you open your computers case, the motherboard is the flat, rectangular piece of circuit board to which the whole thing seems to connect to for one reason or one another. It'

Problems.., what are the different types of tablets?

what are the different types of tablets?

What is public key cryptography, What is Public Key Cryptography Publi...

What is Public Key Cryptography Public-key cryptography is a form of modern cryptography which permits users to communicate safely without lastly agreeing on a shared secret

Binary equivalent of the decimal number 368 , What is the binary equivalent...

What is the binary equivalent of the decimal number 368 ? Ans. 101110000 is the Binary equivalent of the Decimal number 368. From Decimal number to Binary number conversioni

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd