Skip to main content

Prolog in Action

  • Chapter
  • First Online:
Logic Programming with Prolog
  • 3336 Accesses

Abstract

This chapter illustrates how Prolog can be used to develop applications of an ’Artificial Intelligence’ kind. It is shown how to implement (1) an artificial language to control the movements of an imaginary robot and (2) a shell program that can be used to construct a series of similar applications, in this case multiple-choice tests or quizzes.

After reading this chapter you should be able to:

  • Implement an artificial language of your own devising, using the techniques described elsewhere in this book. This will be illustrated by a simple language to control the movements of an imaginary robot

  • Implement a shell program, which can be used to construct a series of similar applications (the example used is a series of multiple-choice tests or quizzes). There are two phases to the implementation: the setup phase, during which the ’content’ of the application is read in from a data file and converted into facts placed in the Prolog database, and the execution phase where a dialogue with the user is automatically generated

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 16.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Readers unfamiliar with trigonometry will lose nothing by taking these formulae (and those that follow) on trust. This is a book about Prolog, not trigonometry.

  2. 2.

    Warning – some versions of Prolog may measure angles in degrees not radians. To check which form of measurement applies to the version of Prolog you are using, enter a query such as

    • ?-X is sin(90).

    If a value of 1 is returned for X, angles are measured in degrees. If the value returned is approximately 0.894 then angles are measured in radians, as is assumed in the main text in this section.

Author information

Authors and Affiliations

Authors

Practical Exercise 13

Practical Exercise 13

Change the definition of the multiple-choice test/quiz shell so that the questions are numbered in sequence, e.g.

Question 1. What is the name of this planet?

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag London

About this chapter

Cite this chapter

Bramer, M. (2013). Prolog in Action. In: Logic Programming with Prolog. Springer, London. https://doi.org/10.1007/978-1-4471-5487-7_13

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-5487-7_13

  • Published:

  • Publisher Name: Springer, London

  • Print ISBN: 978-1-4471-5486-0

  • Online ISBN: 978-1-4471-5487-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics