Working on 2023-12-10 p1

This commit is contained in:
FrederikBaerentsen 2023-12-11 14:25:28 +01:00
parent b05379719f
commit aaca415d2b
6 changed files with 47 additions and 12 deletions

View File

@ -94,40 +94,48 @@ while not found:
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new)) #print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
dirc = 'R' dirc = 'R'
if wall(cur) in ('','','','S'): if wall(cur) in ('','','','S'):
if wall(new) == 'S':
print('Found')
found = True
#print('Went Right') #print('Went Right')
prev = (y,x) prev = (y,x)
y += 1 y += 1
print(wall(new))
sub_found = True sub_found = True
if y > 0 and not sub_found: if y > 0 and not sub_found:
#print('Can go left') #print('Can go left')
# Left # Left
new = (list(cur)[0]-1,list(cur)[1]) new = (list(cur)[0]-1,list(cur)[1])
#print(wall(new))
found = True if wall(new) == 'S' else False
if grid[x][y-1] in ('','','') and new != prev: if grid[x][y-1] in ('','','') and new != prev:
#print('Trying Left') #print('Trying Left')
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new)) #print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
dirc = 'L' dirc = 'L'
if wall(cur) in ('','','','S'): if wall(cur) in ('','','','S'):
if wall(new) == 'S':
print('Found')
found = True
#print('Went Left') #print('Went Left')
prev = (y,x) prev = (y,x)
y -= 1 y -= 1
print(wall(new))
sub_found = True sub_found = True
if x > 0 and not sub_found: if x > 0 and not sub_found:
#print('Can go up') print('Can go up')
# Up # Up
new = (list(cur)[0],list(cur)[1]-1) new = (list(cur)[0],list(cur)[1]-1)
#print(wall(new)) #print(wall(new))
found = True if wall(new) == 'S' else False if grid[x-1][y] in ('','','','S') and new != prev:
if grid[x-1][y] in ('','','') and new != prev: print('Trying Up')
#print('Trying Up') print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
dirc = 'U' dirc = 'U'
if wall(cur) in ('','','','S'): if wall(cur) in ('','','','S'):
#print('Went Up') print('Went Up')
if wall(new) == 'S':
print('Found')
found = True
prev = (y,x) prev = (y,x)
x -=1 x -=1
sub_found = True sub_found = True
@ -137,15 +145,15 @@ while not found:
# Down # Down
new = (list(cur)[0],list(cur)[1]+1) new = (list(cur)[0],list(cur)[1]+1)
#print(wall(new)) #print(wall(new))
if wall(new) == 'S': if grid[x+1][y] in ('','','','S') and new != prev:
#print('Found the S')
found = True
if grid[x+1][y] in ('','','') and new != prev:
#print('Trying Down') #print('Trying Down')
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new)) #print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
dirc = 'D' dirc = 'D'
if wall(cur) in ('','','','S'): if wall(cur) in ('','','','S'):
#print('Went Down') #print('Went Down')
if wall(new) == 'S':
print('Found')
found = True
prev = (y,x) prev = (y,x)
x += 1 x += 1
sub_found = True sub_found = True

5
2023/day10/t3 Normal file
View File

@ -0,0 +1,5 @@
..F.F7.
.7.FJ|.
.|SJ.L7
..|F--J
..LJ...

5
2023/day10/t4 Normal file
View File

@ -0,0 +1,5 @@
7..F.F7.
J.7.FJ|.
F.|SJJ.L7
L..|F--J
...LJL..

5
2023/day10/t5 Normal file
View File

@ -0,0 +1,5 @@
7..F.F7.
J.F--JL7
F.LS.J.|7
L..|F--J
...LJL..

5
2023/day10/t6 Normal file
View File

@ -0,0 +1,5 @@
..F.F7.
.7.FJ|.
.|S---7
..|F--J
..LJ...

7
2023/day10/t7 Normal file
View File

@ -0,0 +1,7 @@
.....---
...F--7.
F7SJ..|.
..F-7||.
..|.L-J.
..L7....
........