add tockens to initial state in editor.py

This commit is contained in:
Pavel 2021-10-22 21:29:21 +02:00
parent 634de79c7d
commit f26b464ff9
1 changed files with 13 additions and 11 deletions

View File

@ -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