diff options
| author | nekineki <nekineki@nekineki.net> | 2022-12-11 14:47:27 +0100 |
|---|---|---|
| committer | nekineki <nekineki@nekineki.net> | 2022-12-11 14:50:32 +0100 |
| commit | fe75c10e350743a1c078f065d69556fecf825ca5 (patch) | |
| tree | 956556a564c9329346dc9d8b1535dc5e365f3d55 /2022/day5/asd.py | |
| parent | a74d2dc54aef546664bcc8c81eb8e01a93e94391 (diff) | |
move files around, update paths
Diffstat (limited to '2022/day5/asd.py')
| -rwxr-xr-x | 2022/day5/asd.py | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/2022/day5/asd.py b/2022/day5/asd.py deleted file mode 100755 index 8fc94fa..0000000 --- a/2022/day5/asd.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -from functools import reduce - -# filename = "ref_mod.txt" -filename = "pzl_mod.txt" - -res1 = '' -res2 = '' -f = open(filename) - -stacks1 = [] -stacks2 = [] -for line in f: - line = line.strip() - - if line == '': - break - - stack = [] - for c in line: - stack.append(c) - stacks1.append(stack) - stacks2.append(stack) -# print(stacks1) - -for line in f: - line = line.strip() - line = line.replace('move', '').replace('from ', '').replace('to ', '').strip() - mcount, mfrom, mto = [int(i) for i in line.split(' ')] - - mfrom -= 1 - mto -= 1 - - to_move = stacks1[mfrom][-mcount:] - stacks1[mfrom] = stacks1[mfrom][:-mcount] - stacks1[mto] = stacks1[mto] + to_move[::-1] - # print(stacks1) - - to_move = stacks2[mfrom][-mcount:] - stacks2[mfrom] = stacks2[mfrom][:-mcount] - stacks2[mto] = stacks2[mto] + to_move - # print(stacks2) - -f.close() - -print(stacks1) -print(stacks2) - -for i in stacks1: - res1 = res1 + i[-1] -print('res1:', res1) - -for i in stacks2: - res2 = res2 + i[-1] -print('res2:', res2) - |
