Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CS 188 Spring 2020 Written Homework 1 17 CS 188 Spring 2020

Beoordeling
-
Verkocht
-
Pagina's
16
Cijfer
A+
Geüpload op
24-10-2021
Geschreven in
2021/2022

CS 188 Spring 2020 Written Homework 1 17 CS 188 Spring 2020

Instelling
Vak

Voorbeeld van de inhoud

CS 188 Introduction to
Spring 2020 Artificial Intelligence Written HW 1 Sol.
Solutions for HW 1 (Written)




1

,Q1. [50 pts] Uninformed Search and Heuristics
Consider the following simplified version of the classic Atari video game, Montezuma’s Revenge: It is played on the
board illustrated below. An agent (represented by the person icon in cell (1,3)) wishes to grab the key (in cell (3,0)).
A skull starts in cell (5,2) and moves to the right by one cell after each action is executed until it ends up in the
rightmost cell, at which point it starts moving to the left, and repeats this pattern back and forth.

The agent can be facing either left or right. There are 10 possible actions for the agent: 2 turning actions
(turn lef t, turn right) and 8 moving actions (lef t, right, up, down, lef t up, lef t down, right up, right down). The
agent can move up or down while facing either direction, but can move sideways or diagonally only if facing in that
direction. For example, if the agent is facing right but tries to move lef t up, the agent will not move and nothing
will happen. Furthermore, if the agent is already facing lef t and a turn lef t action is taken, nothing happens.

Lastly, the agent cannot move into a cell currently occupied by the skull, or a wall.

0 1 2 3 4 5 6

0



1



2



3



4



5



6




(a) Answer the following questions for the Montezuma’s revenge board above:

(i) [4 pts] Let N be the number of possible cell locations that the agent can be in, and let M be the number
of possible cell locations that the skull can be in. Recall that for “pacman pathing”, the representation of
the state was (x, y) where x was the row and y was the column of pacman’s position.
Describe a representation of a state in the state space for this game and give an expression for the size of
the state space.


Representation of the state space: (x, y, f acing direction, x skull, y skull)
Size of the state space: 2 × N × M
Explanation of each term in the size of the state space: There are N possible positions for the agent, 2
directions that the agent can face, and M possible positions for the skull.




2

, (ii) [4 pts] Please fill in the following pseudocode for the getSuccessor function for this game:


procedure getSuccessor(state)
successors ← empty list


turn left, turn right, left, left up, left down, right, right up, right down, up, down

for action ∈ do
right
if action ∈ {lef t, lef t up, lef t down} and state.f acing direction == then
continue
left
if action ∈ {right, right up, right down} and state.f acing direction == then
continue
right
if action ∈ {turn right} and state.f acing direction == then
continue
left
if action ∈ {turn lef t} and state.f acing direction == then
continue
next state ← state.apply action(action)
not in wall not collide with skull
if next state and next state then
successors.append(next state)
return successors




(iii) [2 pts] What is the goal test?
Is our current location (xH , yH ) = (3, 0)?




3

Geschreven voor

Vak

Documentinformatie

Geüpload op
24 oktober 2021
Aantal pagina's
16
Geschreven in
2021/2022
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$7.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
StuviaGuides West Virgina University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
16157
Lid sinds
7 jaar
Aantal volgers
8362
Documenten
5974
Laatst verkocht
9 uur geleden
Accounting, Finance, Statistics, Computer Science, Nursing, Chemistry, Biology & More — A+ Test Banks, Study Guides & Solutions

As a Top 1st Seller on Stuvia and a nursing professional, my mission is to be your light in the dark during nursing school and beyond. I know how stressful exams and assignments can be, which is why I’ve created clear, reliable, and well-structured resources to help you succeed. I offer test banks, study guides, and solution manuals for all subjects — including specialized test banks and solution manuals for business books. My materials have already supported countless students in achieving higher grades, and I want them to be the guide that makes your academic journey easier too. I’m passionate, approachable, and always focused on quality — because I believe every student deserves the chance to excel.

Lees meer Lees minder
4.3

2294 beoordelingen

5
1571
4
305
3
183
2
74
1
161

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen