From 6fedd6979facab8e06ba066b347dfe83e723e6ed Mon Sep 17 00:00:00 2001 From: TheTaques <35156969+TheTaques@users.noreply.github.com> Date: Tue, 24 Aug 2021 14:29:48 +0200 Subject: [PATCH] Move DIFFICULTY_SCALER to challenge_functions.py, specify char import in read_char.py --- bonemarketsolver/challenge_functions.py | 8 ++++++++ bonemarketsolver/read_char.py | 4 ++-- bonemarketsolver/solve.py | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bonemarketsolver/challenge_functions.py b/bonemarketsolver/challenge_functions.py index 5759ece..688b29d 100644 --- a/bonemarketsolver/challenge_functions.py +++ b/bonemarketsolver/challenge_functions.py @@ -1,3 +1,6 @@ +# This is a constant used to calculate difficulty checks. You almost certainly do not need to change this. +DIFFICULTY_SCALER = 0.6 + def narrow_challenge(difficulty_level: int, stat: int): offset = 6 - difficulty_level stat += offset @@ -9,6 +12,11 @@ def narrow_challenge(difficulty_level: int, stat: int): else: return stat/10 +def broad_challenge(difficulty_level: int, stat: int): + chance = DIFFICULTY_SCALER*stat//difficulty_level + + return chance + def mean_outcome(success: int, failure: int, chance: float): mean_success = success*chance mean_failure = failure*(1-chance) diff --git a/bonemarketsolver/read_char.py b/bonemarketsolver/read_char.py index 4d23769..8ddec3f 100644 --- a/bonemarketsolver/read_char.py +++ b/bonemarketsolver/read_char.py @@ -1,5 +1,5 @@ try: - from .custom_char import * + from .custom_char import Char except: print("Note: custom_char.py does not exist. Using default_char.py") - from .default_char import * + from .default_char import Char diff --git a/bonemarketsolver/solve.py b/bonemarketsolver/solve.py index 65b42cf..59305d5 100644 --- a/bonemarketsolver/solve.py +++ b/bonemarketsolver/solve.py @@ -27,8 +27,7 @@ ATTRIBUTE_MULTIPLIER = 10000000 # This is the highest number of attribute to calculate fractional exponents for. MAXIMUM_ATTRIBUTE = 100 -# This is a constant used to calculate difficulty checks. You almost certainly do not need to change this. -DIFFICULTY_SCALER = 0.6 +from .challenge_functions import DIFFICULTY_SCALER def NewIntermediateBoolVar(self, name, expression, domain):