initial commit

This commit is contained in:
Pavel 2021-10-13 20:52:33 +02:00
commit 0ddcd149f6
8 changed files with 637 additions and 0 deletions

12
alrys/README Normal file
View File

@ -0,0 +1,12 @@
This is a modified version of the Python script for the TI-Planet and
Planete Casio back to school 2021 contest.
This modified version works with Python 3 under GNU Linux and MS Windows.
The original code can be found at:
https://tiplanet.org/forum/viewtopic.php?f=49&t=25201
This script can be executed with the following command:
python3 editor.py

BIN
alrys/alrys1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

BIN
alrys/alrys2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

213
alrys/alryslib.c Normal file

File diff suppressed because one or more lines are too long

102
alrys/alryslib.py Normal file

File diff suppressed because one or more lines are too long

BIN
alrys/editor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 KiB

268
alrys/editor.py Normal file

File diff suppressed because one or more lines are too long

42
alrys/test.py Normal file
View File

@ -0,0 +1,42 @@
import sys
from math import atan2, hypot, pi, cos, sin
from alryslib import *
if len(sys.argv) != 2:
print('Usage: python.exe test.py input_file')
sys.exit(1)
buffer = ''
try:
with open(sys.argv[1], 'r') as f:
buffer = f.read()
except IOError:
print('Cannot open %s' % sys.argv[1])
sys.exit(1)
steps = []
for e in buffer.split():
try:
steps.append(float(e))
except:
pass
position = [47.5, 43.5, 0]
index = 2
def mon_itineraire():
global steps, position, index
x, y = steps[index * 2:(index + 1) * 2]
a = atan2(y - position[1], x - position[0]) * 180.0 / pi - position[2]
l = hypot(x - position[0], y - position[1])
a_droite(a)
en_avant(l)
position[2] += a
position[0] += l * cos(position[2] * pi / 180.0)
position[1] += l * sin(position[2] * pi / 180.0)
index += 1
return len(steps) >= (index + 1) * 2
print(aller_selon(mon_itineraire))