From fe75c10e350743a1c078f065d69556fecf825ca5 Mon Sep 17 00:00:00 2001 From: nekineki Date: Sun, 11 Dec 2022 14:47:27 +0100 Subject: move files around, update paths --- 2022/day5/asd.py | 57 -------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100755 2022/day5/asd.py (limited to '2022/day5/asd.py') 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) - -- cgit v1.2.3