COMP3411/9414 Artificial Intelligence
Session 1, 2019

Week 2 Tutorial


Activitity 2.1: PEAS Descriptions
Present to your tutorial group the PEAS model you developed for the activity from "The PEAS Model of an Agent".


Activitity 2.2: Classifying Environments & Choice of Agent Type
Use the PEAS model to classify an environment from the tutorial in Week 1.
  1. Classify each task according to the properties given in lectures in the Classifying Environments page of Week 2 module. Give a one-line justification for each choice.
  2. Select a suitable agent type (or, discuss the relative merits of the different agent types presented).

Activitity 2.4 Sorting in Prolog

  1. Write a prolog predicate insert(Num, List, NewList) that takes a number Num along with a list of numbers List which is already sorted in increasing order, and binds NewList to the list obtained by inserting Num into List so that the resulting list is still sorted in increasing order.
  2. Write a predicate isort(List,NewList) that takes a List of numbers in any order, and binds NewList to the list containing the same numbers sorted in increasing order. Hint: your predicate should call the insert() predicate from part (1).
  3. Write a predicate split(BigList,List1,List2) which takes a list BigList and divides the items into two smaller lists List1 and List2, as evenly as possible (i.e. so that the number of items in List1 and List2 differs by no more that 1). Can it be done without measuring the length of the list?
  4. Write a predicate merge(Sort1,Sort2,Sort) which takes two lists Sort1 and Sort2 that are already sorted in increasing order, and binds Sort to a new list which combines the elements from Sort1 and Sort2, and is sorted in increasing order.
Bonus Challenge (for students who have already studied sorting algorithms in another programming language):
Write a predicate mergesort(List,NewList) which has the same functionality as the isort() predicate from part (2) above, but uses the MergeSort algorithm. Hint: you will need to use the split() and merge() predicates from parts (3) and (4) above.


If additional time remains in the tutorial, you can skip ahead to cover Activity 3.1 from next week's tutorial questions.