Skip to content

Statistic

Exodia edited this page Jul 26, 2022 · 27 revisions

Statistic(): Manages the relationship of possible patners. Using the dictionaries has in memory only the variables to use, I recommend changing the slo values with set(), change(), get()

The best solution is to extend this class to implement some other class ex: SentimentalStatistic(Statistic), PhysicsStatistic(Statistic), GroceriesStatistic(Statistic)...

default mcStatistic = Statistic()
default friendStatistic = Statistic(
    values= {
        "strength"      :   7,
        "intelligence"  :   7,
        "agility"       :   7,
    }
)

Get

(code-snippets: DR_StatisticGet)

$ mc_strength = mcStatistic.get("strength")

Set

(code-snippets: DR_StatisticSet)

$ mcStat.set("strength", 2)
$ mcStat.set("strength", -1)
$ mcStat.set("big", True)

Improvment

(code-snippets: DR_StatisticImprovment)

$ mcStat.improve("strength") # +1
$ mcStat.improve("strength", 2)
$ mcStat.improve("strength", -1)

Compare

(code-snippets: DR_StatisticChallenge)

$ mc_strength = mcStatistic.get("strength")
$ fr_strength = frStatistic.get("strength")
if isGreaterThan(mc_strength, fr_strength ): # mc_strength > fr_strength
    "You have won"
else:
    "You lost"

(code-snippets: DR_StatisticCompareMenu)

$ mc_strength = mcStatistic.get("strength")
menu:
    "Can ..." if isGreaterThan(mc_strength, f0 ): # mc_strength > 0
        # ...

Sentimental Statistic

SentimentalStatistic(Statistic): is a grosse example of an extension of Statistic() thought only of games for adults

default girlSentimental = SentimentalStatistic(gender_attracted = "M", virgin = True)
default mcSentimental = SentimentalStatistic(gender_attracted = "F", virgin = False, against = 20)
Clone this wiki locally