improve draw_path

This commit is contained in:
Pavel 2020-09-26 11:56:30 +02:00
parent fae75338ee
commit 5b2e63ce7c
2 changed files with 15 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -6,8 +6,8 @@ laby_w, laby_h = 20, 12
wl = [676499, 819210, 704161, 828804, 911396, 1010837, 772540, 600182, 526017, 803480, 756064, 701196, 1756736, 1376344, 1158834, 1315990, 1102792, 1323847, 1497194, 1810708, 1327018, 1094903, 1349813]
zint = 2
screen_w, screen_h = laby_w * 50 + 2, laby_h * 50 + 2
zx, zy = (screen_w - zint) / laby_w, (screen_h - zint) / laby_h
zx, zy = 50, 50
screen_w, screen_h = laby_w * zx + zint, laby_h * zy + zint
master = Tk()
master.resizable(0, 0)
@ -116,8 +116,16 @@ def draw_help():
def draw_path():
global canvas, path
canvas.create_text(4, screen_h + 4, anchor = NW, text = '%s' % path[0:12], fill = 'black')
canvas.create_text(4, screen_h + 20, anchor = NW, text = '%s' % path[12:24], fill = 'black')
for i in range(len(path)):
if i == index:
color = 'red'
else:
color = 'blue'
if i < 12:
y = 0
else:
y = 16
canvas.create_text(4 + (i % 12) * 80, screen_h + 4 + y, anchor = NW, text = '(%5.2f, %3.1f)' % path[i], fill = color)
def draw_score(score):
global canvas
@ -178,9 +186,10 @@ def aller_selon(path):
for i in range(len(path)):
tourner(path[i][0])
if i == index:
avancer(path[i][1], 'red')
color = 'red'
else:
avancer(path[i][1], 'blue')
color = 'blue'
avancer(path[i][1], color)
state[5] += sin(fix_angle(state[7])) - state[6] // 2
draw_help()
draw_path()