Answer Key
October 7, 2008
Exam 1
CSIS 5511 Artificial Intelligence 1
Page 1 of 15
Answer Key
CSci 5511 Artificial Intelligence 1
October 7, 2008
Exam 1
1. Problem Representation
20 points [graded by baylor]
Consider the following problem: you are given a path of N white
and black squares. The exact configuration of white and black
squares and the length of the path vary with the instance of the
problem you are given to solve.
You start on the left-most square and the goal is to move off to
the right end of the path in the least number of moves. If you
are on white, you can move 1 or 2 squares right. If you are on a
black square, you can move 1 or 4 squares right.
1.1. Describe how you would represent the state space, including
the states, successor function and goal test.
State Space
array of colors, size 1-N
Solution
array of actions, size
≤
N
State
an integer (position in the problem). Let’s call it
position
Goal Test
position
> N
Operators
move1(position): position = position + 1
move2(position): position = position + 2
when
onWhite(position)
move4(position): position = position + 4
when
onBlack(position)
Discussion
State Space Representation
The world is a one-dimensional array so we’ll represent it that way. A four square world of all
black will look like [B,B,B,B] and an alternating black and white world will look like
[B,W,B,W].
Solution Representation
For this problem, we want to find the sequence of moves to the right so we need to track each
move we make. To represent that sequence, we can use complete-state or incremental-state
representations. For this problem, incremental state makes the most sense. We’ll start with an
empty array of actions []. When we’re done, the array will hold the (ordered) set of moves
(actions) needed to solve the problem. The length of the array depends on the number of actions
needed to solve the problem but, in the worst case, it will be size of the state space.

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*