reset password
Author Message
jungsoolim
Posts: 38
Posted 21:00 Sep 20, 2018 |


    NORTH = 'north'
    EAST = 'east'
    SOUTH = 'south'
    WEST = 'west'
 

@staticmethod
    def hitsAWall(state, action):
        (x, y) = state
        return (x, action) in {(0, MyMDP.WEST),  (4, MyMDP.EAST)} or \
               (y, action) in {(0, MyMDP.SOUTH), (4, MyMDP.NORTH)}
 

How does hitsAWall(state, action) work?

 

Thanks!

rabbott
Posts: 1649
Posted 21:09 Sep 20, 2018 |

hitsAWall returns True if taking the indicated action from the indicated state is blocked by a wall.

For example, hitsAWall(((0, 0), South) and hitsAWall((0, 0), West) should both return True.

But hitsAWall(((0, 0), North) and hitsAWall((0, 0), East) should both return False.

jungsoolim
Posts: 38
Posted 13:50 Sep 21, 2018 |
 

Got it!

Thank you very much!