planning with uncertainty elif == return {( , ): ( , ): ( , + ): elseat ( , return {( , ): ( , ) def (self, , )( ,ys if ='right'return [ ,- ][xelif ='upc'return [- ,- ,- ][yelif ='left'if == return [- - ][yelsereturn elif ='upr'return [[- - ],[- - - ]][ ][yat ( , reward is * + *- = here is the domain of example of poole and mackworth [ here the state is represented as (xywhere counts from zero from the leftand counts from zero upwardsso the state ( is on the bottom-left state mdpexamples py -(continued class grid(gridmdp)""x_dim y_dim grid with rewarding states""def __init__(selfdiscount x_dim= y_dim= )self x_dim x_dim size in -direction self y_dim y_dim size in -direction actions ['up''down''right''left'states [( ,yfor in range(y_dimfor in range(y_dim)self rewarding_states {( , ):- ( , ):- ( , ): ( , ): self fling_states {( , )( , )self xoff {'right': 'up': 'left':- 'down': self yoff {'right': 'up': 'left': 'down':- gridmdp __init__(selfstatesactionsdiscount def intended_next(self, , )"""returns the next state in the direction this is where the agent will end up if to goes in its intended_direction (which it does with probability ""( ,ys if =='up'return (xy+ if + self y_dim else yif =='down'return (xy- if else yif =='right'return ( + if + self x_dim else ,yif =='left'version june