summaryrefslogtreecommitdiff
path: root/master_thesis/frensch_procedures.py
blob: 88aa29db6a06176c45a7cc5969aa5cf4e34356d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3

from __future__ import annotations
import random


class WaterSample:
    def __init__(
        self,
        solid: int,
        algae: int,
        lime: tuple[int, int, int, int],
        toxin: tuple[int, int, int, int],
    ):
        self.solid = solid
        self.algae = algae
        self.lime = lime
        self.toxin = toxin

    def index1(self):
        return (self.lime[3] - self.lime[1]) * self.solid

    def index1_str(self):
        return "(Lime_4 - Lime_2) * Solid"

    def index2(self):
        return (2 * self.algae) + min(self.lime)

    def index2_str(self):
        return "(2 * Algae) + Lime_min"

    def index3(self):
        return max(self.toxin) + min(self.toxin)

    def index3_str(self):
        return "Toxin_max + Toxin_min"

    def index4(self):
        return (self.solid * 2) - self.toxin[3]

    def index4_str(self):
        return "(Solid * 2) - Toxin_4"

    def index5(self):
        return max(self.lime[2], (self.toxin[2] - self.toxin[1]))

    def index5_str(self):
        return "Greater of [(Toxin_3 - Toxin_2), Lime_3]"

    def overall(self):
        return 100 - max(
            self.index1(), self.index2(), self.index3(), self.index4(), self.index5()
        )

    def overall_str(self):
        return "100 - Index_max"

    def print_all(self):
        print(f"Solid: {self.solid}")
        print(f"Algae: {self.algae}")
        print(f"Lime: {self.lime}")
        print(f"Toxin: {self.toxin}")
        print(f"Index 1: {self.index1_str()} = {self.index1()}")
        print(f"Index 2: {self.index2_str()} = {self.index2()}")
        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"Overall Quality: {self.overall_str()} = {self.overall()}")


def random_WaterSample():
    solid = random.randint(1, 9)
    algae = random.randint(1, 9)
    lime = tuple(random.randint(1, 9) for _ in range(4))
    toxin = tuple(random.randint(1, 9) for _ in range(4))

    return WaterSample(solid, algae, lime, toxin)