- commit
- b279e58680bf8aa3f6f568eb946acb89f9b481a6
- parent
- fa1cd8cefbf66263a745dee724d9fb1a1dcb2989
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2021-07-04 10:41
tweak normalize
Diffstat
| M | player.py | 13 | +++++++------ |
1 files changed, 7 insertions, 6 deletions
diff --git a/player.py b/player.py
@@ -99,20 +99,21 @@ def normalize(jumps, threshold): 99 99 # scale 100 100 x_max = jumps.max() 101 101 x_min = x_max * threshold102 -1 y_max = (x_max + 0.5) / 2-1 102 y_max = x_max ** 0.5 103 103 jumps = (jumps - x_min) / (x_max - x_min) * y_max -1 104 jumps *= jumps > 0 104 105 105 106 # privilege jumps back in order to prolong playing106 -1 jumps *= numpy.ones((n, n)) * 0.9 + numpy.tri(n, k=-1) * 0.1-1 107 jumps *= numpy.ones((n, n)) - numpy.tri(n, k=-1).T * 0.5 107 108 108 109 # privilege wide jumps 109 110 M = numpy.zeros((n, n)) 110 111 for i in range(1, n): 111 112 M += numpy.tri(n, k=-i) 112 113 M += numpy.tri(n, k=-i).T113 -1 jumps *= (M / (n - 1)) ** 0.1-1 114 jumps *= (M / (n - 1)) ** 0.4 114 115115 -1 return jumps * (jumps > 0)-1 116 return jumps 116 117 117 118 118 119 def get_next_position(i, jumps): @@ -139,8 +140,8 @@ def parse_args(): 139 140 parser = argparse.ArgumentParser(description=__doc__) 140 141 parser.add_argument('filename') 141 142 parser.add_argument(142 -1 '-t', '--threshold', type=float, default=0.5, help='Between 0 and 1. '143 -1 'A higher value will result in fewer but better jumps. (Default: 0.5)')-1 143 '-t', '--threshold', type=float, default=0.8, help='Between 0 and 1. ' -1 144 'A higher value will result in fewer but better jumps. (Default: 0.8)') 144 145 parser.add_argument( 145 146 '-f', '--force', action='store_true', 146 147 help='Ignore previously saved analysis data.')