incomplete state of day 9 - step 3

This commit is contained in:
Heiko Ludwig 2024-12-11 17:18:58 +01:00
parent b7ea34fd2b
commit 3d51680482

View file

@ -33,22 +33,28 @@ def get_disk(disk_map: str) -> tuple:
def print_disk(disk: list) -> None:
for pos in disk:
if pos is None:
for block in disk:
if block is None:
print(".", end="")
else:
print(pos, end="")
print(block, end="")
print()
def defragment(disk: list, full_blocks: deque, free_blocks: deque) -> None:
while len(free_blocks) > 0:
pass
def main():
disk_map = get_lines("sample-input.txt")[0]
# disk_map = get_lines("sample-input2.txt")[0]
# disk_map = get_lines("sample-input.txt")[0]
disk_map = get_lines("sample-input2.txt")[0]
# disk_map = get_lines("input.txt")[0]
disk, free_blocks, full_blocks = get_disk(disk_map)
print_disk(disk)
print(free_blocks)
print(full_blocks)
# print(free_blocks)
# print(full_blocks)
defragment(disk, free_blocks, full_blocks)
if __name__ == '__main__':