aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-08-28 02:28:01 -0600
committerSelene ToyKeeper2019-08-28 02:28:01 -0600
commita67ba8d52f04fc74d90f1885325f76cec04546f4 (patch)
tree0a202fbaf88af11ee0f9b1c1bdf97dec3e12e039
parentfixed attiny13 builds (diff)
downloadanduril-a67ba8d52f04fc74d90f1885325f76cec04546f4.tar.gz
anduril-a67ba8d52f04fc74d90f1885325f76cec04546f4.tar.bz2
anduril-a67ba8d52f04fc74d90f1885325f76cec04546f4.zip
added arbitrary ramp shape powers to level_calc.py, to more easily hit specific values
Diffstat (limited to '')
-rwxr-xr-xbin/level_calc.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/level_calc.py b/bin/level_calc.py
index f16f8ce..6f07621 100755
--- a/bin/level_calc.py
+++ b/bin/level_calc.py
@@ -14,7 +14,7 @@ def main(args):
"""
# Get parameters from the user
questions_main = [
- (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, seventh, ninth, log]'),
+ (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, seventh, ninth, log, N.NN]'),
(int, 'num_channels', 1, 'How many power channels?'),
(int, 'num_levels', 4, 'How many total levels do you want?'),
]
@@ -179,11 +179,19 @@ shapes = dict(
)
def power(x):
- return shapes[ramp_shape][0](x)
+ try:
+ factor = float(ramp_shape)
+ return math.pow(x, factor)
+ except ValueError:
+ return shapes[ramp_shape][0](x)
def invpower(x):
- return shapes[ramp_shape][1](x)
+ try:
+ factor = float(ramp_shape)
+ return math.pow(x, 1.0 / factor)
+ except ValueError:
+ return shapes[ramp_shape][1](x)
def input_text():
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.