diff --git a/Chapter 4/Ex4.2.py b/Chapter 4/Ex4.2.py index 4992a38..3ac2548 100644 --- a/Chapter 4/Ex4.2.py +++ b/Chapter 4/Ex4.2.py @@ -17,7 +17,7 @@ def move(self, u): # get next S elif self.id - 1 == 0: return 0 elif self.id == 16: - return 16 + return 12 else: return self.id if u == 'R': # move right @@ -26,7 +26,7 @@ def move(self, u): # get next S elif self.id + 1 == 15: return 0 elif self.id == 16: - return 16 + return 14 else: return self.id if u == 'U': # move up @@ -92,7 +92,7 @@ def draw(valueArray): print("| | "+str(int(valueArray[16])) +" | | |") print("----------------------") print("Accurate State Values List:") - for i in range(1,8): + for i in range(1,9): print("State "+str(2*i-1)+": "+str(valueArray[2*i-1])+ " State "+str(2*i)+": "+str(valueArray[2*i])) if __name__ == '__main__':