From 8b4adf1563fe7ea462166b75e9b0138c02c3056f Mon Sep 17 00:00:00 2001 From: Yelin Zhang <30687616+Yelinz@users.noreply.github.com> Date: Mon, 20 May 2024 13:25:33 +0200 Subject: [PATCH 1/2] correction for Ex4.2.py --- Chapter 4/Ex4.2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chapter 4/Ex4.2.py b/Chapter 4/Ex4.2.py index 4992a38..049a968 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 From 82fcb8a22853bcc37658a281a558122a8d48e5d6 Mon Sep 17 00:00:00 2001 From: Yelin Zhang <30687616+Yelinz@users.noreply.github.com> Date: Mon, 20 May 2024 13:34:25 +0200 Subject: [PATCH 2/2] Ex4.2.py print state 16 accurate value --- Chapter 4/Ex4.2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter 4/Ex4.2.py b/Chapter 4/Ex4.2.py index 049a968..3ac2548 100644 --- a/Chapter 4/Ex4.2.py +++ b/Chapter 4/Ex4.2.py @@ -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__':