From 6c1adde2056151fafe330ef9970403db5d372ce0 Mon Sep 17 00:00:00 2001 From: Stephen Childs Date: Thu, 13 Jan 2022 10:56:50 -0500 Subject: [PATCH] Move harvest calculation outside rat condition. This fixes an error where the harvest was only added to the total bushels if rats ate some. Note in the BASIC file, we check to see if rats eat the grain in line 522 and if not, go to line 530, which is where the `S=S-E+H` calculation is done. --- 43_Hammurabi/python/hamurabi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/43_Hammurabi/python/hamurabi.py b/43_Hammurabi/python/hamurabi.py index 7c18f892..17c61982 100644 --- a/43_Hammurabi/python/hamurabi.py +++ b/43_Hammurabi/python/hamurabi.py @@ -154,7 +154,8 @@ while Z < 11: # line 270. main loop. while the year is less than 11 if int(C / 2) == C / 2: # even number. 50/50 chance # REM *** RATS ARE RUNNING WILD!! E = int(S / C) # calc losses due to rats, based on previous random number - S = S - E + H # deduct losses from stores + + S = S - E + H # deduct losses from stores C = gen_random() # REM *** LET'S HAVE SOME BABIES