diff options
Diffstat (limited to 'master_thesis/frensch_procedures.py')
-rw-r--r-- | master_thesis/frensch_procedures.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/master_thesis/frensch_procedures.py b/master_thesis/frensch_procedures.py index 66f1c8c..42c6f14 100644 --- a/master_thesis/frensch_procedures.py +++ b/master_thesis/frensch_procedures.py @@ -98,9 +98,32 @@ class WaterSample: print(f"Index 3: {self.index3_str()} = {self.index3()}") print(f"Index 4: {self.index4_str()} = {self.index4()}") print(f"Index 5: {self.index5_str()} = {self.index5()}") + print(f"Index 6: {self.index6_str()} = {self.index6()}") print(f"Overall Quality: {self.overall_str()} = {self.overall()}") +# No step should produce a negative number, greater/lesser of comparisons should not +# use equal numbers +def constrained_WaterSample(): + water_sample = random_WaterSample() + resample = True + while resample: + water_sample = random_WaterSample() + resample = False + # check for negative results + for proc in water_sample.procedure_dict().keys(): + if water_sample.procedure_dict()[proc][0]() < 0: + resample = True + # check for greater/lesser equality + # procedure 5 + if (water_sample.toxin[2] - water_sample.toxin[1]) == water_sample.lime[2]: + resample = True + # procedure 6 + if (water_sample.lime[0] + water_sample.toxin[0]) == water_sample.algae: + resample = True + return water_sample + + def random_WaterSample(): solid = random.randint(1, 9) algae = random.randint(1, 9) |