From f26b464ff9a3a39241a322427093d740d4cbb4a6 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 22 Oct 2021 21:29:21 +0200 Subject: [PATCH] add tockens to initial state in editor.py --- alrys/editor.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/alrys/editor.py b/alrys/editor.py index 5541316..56a7b0c 100644 --- a/alrys/editor.py +++ b/alrys/editor.py @@ -59,15 +59,15 @@ def read_steps(buffer): def write_steps(steps): buffer = '\n' - buffer += 'state (boat donjons):\n' - buffer += '%d %d\n' % (steps[0], steps[1]) + buffer += 'state (l t b d):\n' + buffer += '%3d %d %d %d\n' % (steps[0], steps[1], steps[2], steps[3]) buffer += '\n' buffer += 'start (x a y b):\n' - buffer += '%7.3f %2d %6.3f %2d\n' % (steps[2], steps[3], steps[4], steps[5]) + buffer += '%7.3f %2d %6.3f %2d\n' % (steps[4], steps[5], steps[6], steps[7]) buffer += '\n' buffer += 'steps (x a y b):\n' size = len(steps) - for k in range(6, size - 3, 4): + for k in range(8, size - 3, 4): x2, a, y2, b = steps[k:k + 4] buffer += '%7.3f %2d %6.3f %2d\n' % (x2, a, y2, b) return buffer @@ -81,7 +81,7 @@ def optimize(): kmax = -1 cmax = -1 size = len(steps) - for k in range(6, size, 2): + for k in range(8, size, 2): backup = steps[k] for v in [-0.03, -0.02, -0.01, 0.01, 0.02, 0.03]: steps[k] = backup + v @@ -137,13 +137,15 @@ def draw_path(steps, draw = True): a1 = 0 size = len(steps) if size >= 6: - state[6] = steps[0] - state[9] = steps[1] - x1, a, y1, b = steps[2:6] + state[4] = steps[0] + state[5] = steps[1] + state[6] = steps[2] + state[9] = steps[3] + x1, a, y1, b = steps[4:8] x1 += a * 1e-14 y1 += b * 1e-14 state[0:2] = x1, y1 - for k in range(6, size - 3, 4): + for k in range(8, size - 3, 4): x2, a, y2, b = steps[k:k + 4] x2 += a * 1e-14 y2 += b * 1e-14 @@ -299,8 +301,8 @@ def a_droite(a): state[2] += a coordinates = [0, 0, None] buffer = ''' -state (boat donjons): -0 0 +state (l t b d): +250 1 0 0 start (x a y b): 47.500 0 43.500 0