Skip to content

Commit cc1f75b

Browse files
committed
Merge pull request #56 from varshit97/master
Fix import error in utils.py and compile error in mdp.py
2 parents 523936c + a9ecd7d commit cc1f75b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

mdp.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ class MDP:
1818
actions for each state. [page 646]"""
1919

2020
def __init__(self, init, actlist, terminals, gamma=.9):
21-
update(self, init=init, actlist=actlist, terminals=terminals,
22-
gamma=gamma, states=set(), reward={})
21+
self.init=init
22+
self.actlist=actlist
23+
self.terminals=terminals
24+
self.gamma=gamma
25+
self.states=set()
26+
self.reward={}
2327

2428
def R(self, state):
2529
"Return a numeric reward for this state."
@@ -48,7 +52,9 @@ def __init__(self, grid, terminals, init=(0, 0), gamma=.9):
4852
grid.reverse() ## because we want row 0 on bottom, not on top
4953
MDP.__init__(self, init, actlist=orientations,
5054
terminals=terminals, gamma=gamma)
51-
update(self, grid=grid, rows=len(grid), cols=len(grid[0]))
55+
self.grid=grid
56+
self.rows=len(grid)
57+
self.cols=len(grid[0])
5258
for x in range(self.cols):
5359
for y in range(self.rows):
5460
self.reward[x, y] = grid[y][x]

utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Provide some widely useful functions and objects."""
22

3+
import re
4+
35
infinity = float('inf')
46

57
argmin = min

0 commit comments

Comments
 (0)