-
-
Notifications
You must be signed in to change notification settings - Fork 5
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,
}
)
(code-snippets: DR_StatisticGet
)
$ mc_strength = mcStatistic.get("strength")
(code-snippets: DR_StatisticSet
)
$ mcStatistic.set("strength", 2)
$ mcStatistic.set("strength", -1)
$ mcStatistic.set("big", True)
(code-snippets: DR_StatisticImprovment
)
$ mcStatistic.improve("strength") # +1
$ mcStatistic.improve("strength", 2)
$ mcStatistic.improve("strength", -1)
(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
# ...
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)