incomplete state of day 9 - step 3
This commit is contained in:
parent
b7ea34fd2b
commit
3d51680482
1 changed files with 14 additions and 8 deletions
|
|
@ -33,23 +33,29 @@ 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__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue