Hi Everyone,
Post your solutions to the Oct 11 In-Class Exercise to this thread.
Best,
Chris
Knowledge base: A database of explored squares (inputed into a 2d array of list objects [stench, breeze, glitter, bump, scream, explored] with each filled with a value, ? for unknown, x for known, and x? for posibility) and partially guessed squares with flags
Tell: If a stench, breeze, glitter, bump, scream is detected mark adjacent unexplored squares with the proper flags and set unexplored to explored in current square.
Ask: What is currently sensed?
(Edited: 2017-10-11)Student: Xin (Joy) Yan
(Edited: 2017-10-11)Student: Phyllis Lau
Ans: <br> We can use python dictionary to store what we know, for instance: we can store the square coordinates as the key, and store whatever we know about that square as the corresponding value. i.e. {2.1: ok, 3.1: pit…..} <br><br>
Ans: <br> If the agent senses anything in the current square, we will update its neighbor squares with the sense. e.g. When we are at square 2.1 and sense breeze, we will use the dictionary to get the square coordinates and set its value as pit. i.e. {2.1: ok, 2.2: possible pit, 3.1: possible pit, ….} <br><br>
Ans: <br> If we want to know a specific square information, we will use dictionary to retrieve the value by the given key. e.g. If we want to know square 2.1, we can use dict.get(2.1), then it will return the value (i.e. ok) that we want to know <br>
(Edited: 2017-10-11)2.Tell would simply be to add percepts and state of a certain room. And update neighbors possible state 3.ask would simply return what it knows about a room. It will search up the room in the matrix and return all percepts or data in the node.
coordinates would be used as keys and percepts would be used as values.
corresponds to the grid tile's coordinate and setting that entry's value to the percepts received.
corresponds to the requested grid tile's coordinate.
multidimensional array with the appropriate values take the database as input. for every listed location marked with the following values of known, unknown and partially guessed..
Tell: If any of the entries in the array is found mark the adjacent unvisited squares with the proper value. Ask: What location i am currently exploring
Each square -> an object square letter: (B, G, P, S, W) square confirmed: boolean boolean visited
2-d List of squares list(i, j) = square (i,j)
square get's an updated letter, and its visited is set to true