Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Midterm Exam - Introduction to Artificial Intelligence - Fall 2007 | CCIS 475, Exams of Computer Science

Material Type: Exam; Professor: Molnar; Class: Intro to Artificial Intell.; Subject: Computer and Info Science; University: Clark Atlanta University; Term: Fall 2007;

Typology: Exams

Pre 2010

Uploaded on 08/04/2009

koofers-user-506
koofers-user-506 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CIS 475 - Midterm Exam
Fall 2007
Assume a robot that has the functions left, right and go:
left and right make the robot turn around by 90 degrees, right turns clockwise, left
counter - clockwise.
Go makes the robot move for a certain distance in a straight line in the direction it is
currently facing. The go function is implemented as a structure go(d) with the number
of blocks d, e.g. go(4) lets the robot move four blocks forward.
N
0a
1
2
3
4b c
5
6
7
8d e f
9
10 g h i
11
12 j
13
14 k
15 l
y/x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
The following paths between notes are defined as Prolog facts. Each path begins under
the assumption that the robot is facing south. When it arrives at its destination it will face
south again. IMPORTANT: the robot only knows these paths. The path predicate is
defined in the file http://www.cis.cau.edu/475/prolog/robotmaze.pl
path(a, b, [ go(4), right, go(7), left]).
path(b, e, [left, go(7), right, go(4)]).
/Users/molnar/Documents/Classes/CIS475/F07/qz/midterm-web.html October 12, 2007 1 of 3
pf3

Partial preview of the text

Download Midterm Exam - Introduction to Artificial Intelligence - Fall 2007 | CCIS 475 and more Exams Computer Science in PDF only on Docsity!

CIS 475 - Midterm Exam

Fall 2007 Assume a robot that has the functions left, right and go:

  • left and right make the robot turn around by 90 degrees, right turns clockwise, left counter- clockwise.
  • Go makes the robot move for a certain distance in a straight line in the direction it is currently facing. The go function is implemented as a structure go( d ) with the number of blocks d, e.g. go(4) lets the robot move four blocks forward.

N

0 a 1 2 3 4 b^ c 5 6 7 8 d^ e^ f 9 10 g^ h^ i 11 12 j 13 14 k 15 l y/x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The following paths between notes are defined as Prolog facts. Each path begins under the assumption that the robot is facing south. When it arrives at its destination it will face south again. IMPORTANT: the robot only knows these paths. The path predicate is defined in the file http://www.cis.cau.edu/475/prolog/robotmaze.pl path(a, b, [ go(4), right, go(7), left]). path(b, e, [left, go(7), right, go(4)]).

path(a, c, [go(1), left, go(6), right, go(3)]). path(b, d, path(d, k, path(d, g, path(c, h, path(a, f, path(f, i, path(h, i, path(i, l,

Notes

  • Create a text document (MSWord or plain text) for this assignment. Insert your answers, programs and results in this document.
  • Upload the document to TurnItIn.com
  • Prolog predicates have an arity, which is the number of arguments. When referred to a predicate the arity is attached to the name, separated by a slash. E.g. move/3 refers to a predicate with the name "move" that has three arguments. This notation is not part of the Prolog syntax!
  • Prolog has some mathematical functions defined: e.g. exp(X), sin(X), sqrt(X). They are pretty much used in the same way as in C or JAVA.

PROBLEMS

  1. All nodes that have a known path between them are connected. Note, the instructions given in the path only lead the robot from the origin node to the destination node. a) Complete the missing path definitions according to the map of the maze.
  2. If the robot knows how to get from one node to another, it should be able to reverse the path, in order to find his way back a) Explain how a given path, i.e. a list of instructions to get from one node to another, can be used to produce the reverse path. What has to be observed? b) Define the Prolog predicate rev/2 that takes a list of moves (instructions) and returns the reverse.
  3. The structure path/3 can be seen as a relation between the two nodes. This should allow us to define a new relation move/3 between two nodes that is built on path/. a) Explain how the path of two nodes can be used to create new paths between nodes, i.e. connect nodes that are not connected by a know path. b) Write the rules for a new relation move/3 in plain English. Consider the direction of the relation. c) Define the move/3 predicate in Prolog. The first two arguments are the nodes for which move has to find a path, (first argument is the origin, second the destination), the third argument is the output, the list of moves that lead from origin to destination. Your Prolog definition will use the predicates path/3 , conc/3 (from the