Skip to content
Snippets Groups Projects
Commit b8ed1063 authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Fix input for spaceshipsolver.

parent a0187c03
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import numpy as np
import sys
def spaceshipsolver(coordinates):
"""
:param coordinates:
list of np arrays (of size 2).
"""
velocity=np.array([0,0])
moves=""
curr_coords = np.array([0,0])
......@@ -44,11 +51,10 @@ def spaceshipsolver(coordinates):
def list_coordinates_to_arrays(coordinates):
return [np.array(x) for x in coordinates]
coords=input('coords:')
coords=coords.split('.')
for x in range(len(coords)):
coords[x]=coords[x].split(',')
for k in range(len(coords[x])):
coords[x][k]=int(coords[x][k])
coords=list_coordinates_to_arrays(coords)
print(spaceshipsolver(coords))
data = []
for line in sys.stdin.readlines():
print(repr(line))
data.append(np.array([int(s) for s in line.strip().split(' ')]))
print(spaceshipsolver(data))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment