teeme edas
This commit is contained in:
@@ -1,23 +1,63 @@
|
|||||||
|
def checksouth(x, y):
|
||||||
|
print('south')
|
||||||
|
|
||||||
|
|
||||||
|
def checknorth(x, y):
|
||||||
|
print('south')
|
||||||
|
|
||||||
|
|
||||||
|
def checkwest(x, y):
|
||||||
|
print('south')
|
||||||
|
|
||||||
|
|
||||||
|
def checkeast(x, y):
|
||||||
|
print('south')
|
||||||
|
|
||||||
|
|
||||||
def otsing(x, y, tase):
|
def otsing(x, y, tase):
|
||||||
print(otsin)
|
if ruum[x][y] == 'S':
|
||||||
|
checknorth(x, y)
|
||||||
|
checksouth(x, y)
|
||||||
|
checkwest(x, y)
|
||||||
|
checkeast(x, y)
|
||||||
|
if ruum[x][y] == "|":
|
||||||
|
checknorth(x, y)
|
||||||
|
checksouth(x, y)
|
||||||
|
if ruum[x][y] == "-":
|
||||||
|
checkeast(x, y)
|
||||||
|
checkwest(x, y)
|
||||||
|
if ruum[x][y] == "L":
|
||||||
|
checknorth(x, y)
|
||||||
|
checkeast(x, y)
|
||||||
|
if ruum[x][y] == "J":
|
||||||
|
checknorth(x, y)
|
||||||
|
checkwest(x, y)
|
||||||
|
if ruum[x][y] == "F":
|
||||||
|
checksouth(x, y)
|
||||||
|
checkwest(x, y)
|
||||||
|
if ruum[x][y] == "7":
|
||||||
|
checksouth(x, y)
|
||||||
|
checkwest(x, y)
|
||||||
|
|
||||||
|
|
||||||
with open("data.txt") as file:
|
with open("data.txt") as file:
|
||||||
lines = [line.rstrip() for line in file]
|
lines = [line.rstrip() for line in file]
|
||||||
|
|
||||||
ruum = []
|
ruum = []
|
||||||
|
leitud = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
ruum.append([*line])
|
ruum.append([*line])
|
||||||
|
leitud.append([*line])
|
||||||
|
|
||||||
print(ruum)
|
print(ruum)
|
||||||
|
|
||||||
leitud = false
|
leitud = False
|
||||||
for x, rida in enumerate(ruum):
|
for x, rida in enumerate(ruum):
|
||||||
for y, koht in enumerate(rida):
|
for y, koht in enumerate(rida):
|
||||||
print(f"x={x}, y={y}, koht={koht}")
|
print(f"x={x}, y={y}, koht={koht}")
|
||||||
if koht == 'S':
|
if koht == 'S':
|
||||||
otsing(x, y, 0)
|
otsing(x, y, 0)
|
||||||
leitud = true
|
leitud = True
|
||||||
break
|
break
|
||||||
if leitud:
|
if leitud:
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user