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

Why a linked list is called a dynamic data structure, Why a linked list is ...

Why a linked list is called a dynamic data structure? What are the advantages of using linked list over arrays?    A linked list is known as a dynamic data structure because it

What are called stalls, What are called stalls? An alternative represen...

What are called stalls? An alternative representation of the operation of a pipeline in the case of a cache miss gives the function performed by every pipeline stage in each cl

Define e-cash, What do you understand by E-cash? E-Cash Ecash is ...

What do you understand by E-cash? E-Cash Ecash is a cash which is showed by two models. One is the on-line form of e-cash which permits for the completion of all types of

Define input-output interface, Define Input-Output Interface. I/O inter...

Define Input-Output Interface. I/O interface gives a method for transferring information among internal storage and external I/O devices

Explain how presentation layer helps in establishing, Explain how presentat...

Explain how presentation layer helps in establishing and processing data in End to End layers. The idea of the presentation layer is to stand for information to the communicati

Name some multimedia applications, Illustrate what are the Multimedia appli...

Illustrate what are the Multimedia applications Multimedia comprise the use of a computer to present: - Text - Video - Graphics - Sound - Animation In an inte

Define the heat transfer processes, Heat Transfer Coursework An interna...

Heat Transfer Coursework An internal combustion engine of a passenger car is operating at steady state conditions e.g. constant speed (r.p.m.) and load (torque), so the engine

Program level, Program Level This is usually the dependability of the o...

Program Level This is usually the dependability of the operating system, which runs processes simultaneously. Different programs are evidently independent of each other. So par

What is the purpose of reserved word using in c#, A keyword that states the...

A keyword that states the types in a particular namespace can be referred to without requiring their full qualified type names. 'using' reserved word always come with namespace

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