initial commit
This commit is contained in:
commit
0ddcd149f6
|
@ -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
|
Binary file not shown.
After Width: | Height: | Size: 639 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 896 KiB |
File diff suppressed because one or more lines are too long
|
@ -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))
|
Loading…
Reference in New Issue