@@ -0,0 +1,39 @@ | |||
from string import ascii_letters | |||
DEBUG=False | |||
def debug(*args): | |||
if DEBUG: | |||
print(args) | |||
def within(first, second): | |||
if ((first[0] <= second[0] and first[1] >= second[1]) | |||
or (second[0] <= first[0] and second[1] >= first[1])): | |||
return True | |||
return False | |||
def main(): | |||
with open("input4.txt", "r") as file: | |||
inlines = [line.strip() for line in file.readlines()] | |||
overlaps = [] | |||
range_pairs = [] | |||
for line in inlines: | |||
first, second = line.split(",") | |||
sfirst = first.split("-") | |||
pfirst = (int(sfirst[0]), int(sfirst[1])) | |||
ssecond = second.split("-") | |||
psecond = (int(ssecond[0]), int(ssecond[1])) | |||
if within(pfirst, psecond): | |||
overlaps.append(1) | |||
else: | |||
overlaps.append(0) | |||
range_pairs.append((pfirst, psecond)) | |||
print(sum(overlaps)) | |||
if __name__ == "__main__": | |||
main() |
@@ -0,0 +1,47 @@ | |||
from string import ascii_letters | |||
DEBUG=False | |||
def debug(*args): | |||
if DEBUG: | |||
print(args) | |||
def within(first, second): | |||
if ((first[0] <= second[0] and first[1] >= second[1]) | |||
or (second[0] <= first[0] and second[1] >= first[1])): | |||
return True | |||
return False | |||
def overlap(first, second): | |||
if ((first[0] < second[0] and first[1] < second[0]) | |||
or (first[0] > second[1] and first[1] > second[1]) | |||
or (second[0] < first[0] and second[1] < first[0]) | |||
or (second[0] > first[1] and second[1] > first[1])): | |||
return False | |||
return True | |||
def main(): | |||
with open("input4.txt", "r") as file: | |||
inlines = [line.strip() for line in file.readlines()] | |||
overlaps = [] | |||
range_pairs = [] | |||
for line in inlines: | |||
first, second = line.split(",") | |||
sfirst = first.split("-") | |||
pfirst = (int(sfirst[0]), int(sfirst[1])) | |||
ssecond = second.split("-") | |||
psecond = (int(ssecond[0]), int(ssecond[1])) | |||
if overlap(pfirst, psecond): | |||
overlaps.append(1) | |||
else: | |||
overlaps.append(0) | |||
range_pairs.append((pfirst, psecond)) | |||
print(sum(overlaps)) | |||
if __name__ == "__main__": | |||
main() |
@@ -0,0 +1,59 @@ | |||
from string import ascii_letters | |||
DEBUG=False | |||
STACKS_START = """FCPGQR | |||
WTCP | |||
BHPMC | |||
LTQSMPR | |||
PHJZVGN | |||
DPJ | |||
LGPZFJTR | |||
NLHCFPTJ | |||
GVZQHTCW""" | |||
def debug(*args): | |||
if DEBUG: | |||
print(args) | |||
def main(): | |||
stacks = {} | |||
stacks_lines = STACKS_START.split("\n") | |||
for i, line in enumerate(stacks_lines): | |||
j = i+1 | |||
for l in line: | |||
p = stacks.get(j, []) | |||
p.append(l) | |||
stacks[j] = p | |||
print(stacks) | |||
with open("input5.txt", "r") as file: | |||
inlines = [line.strip() for line in file.readlines()] | |||
instructions = [] | |||
for line in inlines: | |||
words = line.split(" ") | |||
moves = [] | |||
for word in words: | |||
try: | |||
moves.append(int(word)) | |||
except ValueError: | |||
pass | |||
instructions.append(moves) | |||
for move in instructions: | |||
number, stack_from, stack_to = move | |||
f = stacks[stack_from] | |||
t = stacks[stack_to] | |||
for _ in range(number): | |||
crate = f.pop() | |||
t.append(crate) | |||
stacks[stack_from] = f | |||
stacks[stack_to] = t | |||
for num, stack in stacks.items(): | |||
print(f"{num}: {stack[-1]}") | |||
if __name__ == "__main__": | |||
main() |
@@ -0,0 +1,60 @@ | |||
from string import ascii_letters | |||
DEBUG=False | |||
STACKS_START = """FCPGQR | |||
WTCP | |||
BHPMC | |||
LTQSMPR | |||
PHJZVGN | |||
DPJ | |||
LGPZFJTR | |||
NLHCFPTJ | |||
GVZQHTCW""" | |||
def debug(*args): | |||
if DEBUG: | |||
print(args) | |||
def main(): | |||
stacks = {} | |||
stacks_lines = STACKS_START.split("\n") | |||
for i, line in enumerate(stacks_lines): | |||
j = i+1 | |||
for l in line: | |||
p = stacks.get(j, []) | |||
p.append(l) | |||
stacks[j] = p | |||
print(stacks) | |||
with open("input5.txt", "r") as file: | |||
inlines = [line.strip() for line in file.readlines()] | |||
instructions = [] | |||
for line in inlines: | |||
words = line.split(" ") | |||
moves = [] | |||
for word in words: | |||
try: | |||
moves.append(int(word)) | |||
except ValueError: | |||
pass | |||
instructions.append(moves) | |||
for move in instructions: | |||
number, stack_from, stack_to = move | |||
n_num = 0-number | |||
f = stacks[stack_from] | |||
t = stacks[stack_to] | |||
f_moved = f[n_num:] | |||
f_left = f[:n_num] | |||
t.extend(f_moved) | |||
stacks[stack_from] = f_left | |||
stacks[stack_to] = t | |||
for num, stack in stacks.items(): | |||
print(f"{num}: {stack[-1]}") | |||
if __name__ == "__main__": | |||
main() |
@@ -0,0 +1,502 @@ | |||
move 2 from 2 to 8 | |||
move 2 from 1 to 6 | |||
move 8 from 7 to 1 | |||
move 7 from 5 to 4 | |||
move 1 from 6 to 4 | |||
move 1 from 6 to 3 | |||
move 6 from 3 to 5 | |||
move 9 from 8 to 1 | |||
move 3 from 6 to 7 | |||
move 14 from 4 to 1 | |||
move 6 from 1 to 7 | |||
move 16 from 1 to 9 | |||
move 6 from 1 to 4 | |||
move 1 from 8 to 6 | |||
move 4 from 1 to 5 | |||
move 11 from 9 to 7 | |||
move 2 from 1 to 8 | |||
move 1 from 6 to 7 | |||
move 1 from 8 to 7 | |||
move 1 from 8 to 3 | |||
move 7 from 4 to 3 | |||
move 14 from 7 to 6 | |||
move 8 from 6 to 9 | |||
move 19 from 9 to 2 | |||
move 1 from 1 to 2 | |||
move 2 from 9 to 7 | |||
move 9 from 7 to 8 | |||
move 2 from 2 to 8 | |||
move 16 from 2 to 9 | |||
move 4 from 8 to 2 | |||
move 1 from 7 to 9 | |||
move 3 from 9 to 6 | |||
move 3 from 3 to 6 | |||
move 11 from 9 to 2 | |||
move 7 from 5 to 3 | |||
move 2 from 5 to 9 | |||
move 6 from 6 to 4 | |||
move 1 from 6 to 4 | |||
move 4 from 6 to 8 | |||
move 5 from 9 to 1 | |||
move 4 from 1 to 7 | |||
move 3 from 2 to 6 | |||
move 3 from 4 to 1 | |||
move 1 from 4 to 1 | |||
move 2 from 1 to 3 | |||
move 4 from 3 to 7 | |||
move 1 from 5 to 2 | |||
move 3 from 1 to 6 | |||
move 15 from 2 to 5 | |||
move 3 from 6 to 3 | |||
move 13 from 3 to 8 | |||
move 2 from 4 to 2 | |||
move 9 from 5 to 4 | |||
move 2 from 2 to 5 | |||
move 5 from 7 to 5 | |||
move 10 from 8 to 6 | |||
move 1 from 2 to 5 | |||
move 10 from 4 to 6 | |||
move 4 from 8 to 6 | |||
move 3 from 7 to 1 | |||
move 3 from 1 to 9 | |||
move 1 from 2 to 1 | |||
move 8 from 5 to 2 | |||
move 3 from 6 to 9 | |||
move 6 from 8 to 5 | |||
move 6 from 9 to 2 | |||
move 1 from 1 to 9 | |||
move 10 from 2 to 1 | |||
move 4 from 8 to 5 | |||
move 10 from 5 to 9 | |||
move 11 from 9 to 7 | |||
move 5 from 7 to 9 | |||
move 1 from 9 to 2 | |||
move 3 from 2 to 9 | |||
move 2 from 2 to 8 | |||
move 4 from 9 to 5 | |||
move 4 from 1 to 9 | |||
move 5 from 5 to 2 | |||
move 5 from 1 to 4 | |||
move 21 from 6 to 9 | |||
move 3 from 2 to 9 | |||
move 2 from 8 to 1 | |||
move 25 from 9 to 6 | |||
move 4 from 5 to 7 | |||
move 1 from 4 to 6 | |||
move 6 from 6 to 4 | |||
move 3 from 4 to 6 | |||
move 7 from 7 to 3 | |||
move 4 from 9 to 1 | |||
move 3 from 7 to 8 | |||
move 2 from 9 to 8 | |||
move 2 from 2 to 8 | |||
move 4 from 1 to 3 | |||
move 9 from 6 to 2 | |||
move 13 from 6 to 4 | |||
move 13 from 4 to 5 | |||
move 1 from 5 to 8 | |||
move 2 from 2 to 3 | |||
move 6 from 5 to 3 | |||
move 19 from 3 to 6 | |||
move 1 from 4 to 9 | |||
move 2 from 8 to 1 | |||
move 5 from 2 to 3 | |||
move 5 from 1 to 9 | |||
move 7 from 5 to 4 | |||
move 1 from 8 to 3 | |||
move 1 from 2 to 6 | |||
move 8 from 6 to 3 | |||
move 1 from 9 to 8 | |||
move 11 from 4 to 2 | |||
move 1 from 4 to 6 | |||
move 1 from 2 to 8 | |||
move 5 from 3 to 4 | |||
move 4 from 9 to 6 | |||
move 1 from 6 to 8 | |||
move 9 from 3 to 1 | |||
move 7 from 2 to 9 | |||
move 1 from 2 to 6 | |||
move 3 from 1 to 8 | |||
move 2 from 2 to 3 | |||
move 3 from 9 to 7 | |||
move 3 from 4 to 7 | |||
move 2 from 4 to 3 | |||
move 2 from 3 to 5 | |||
move 8 from 6 to 4 | |||
move 6 from 8 to 6 | |||
move 2 from 9 to 4 | |||
move 5 from 8 to 6 | |||
move 3 from 7 to 5 | |||
move 1 from 5 to 8 | |||
move 1 from 8 to 2 | |||
move 1 from 5 to 1 | |||
move 11 from 4 to 9 | |||
move 2 from 6 to 3 | |||
move 2 from 2 to 4 | |||
move 6 from 1 to 2 | |||
move 6 from 2 to 1 | |||
move 3 from 7 to 3 | |||
move 2 from 4 to 7 | |||
move 4 from 6 to 5 | |||
move 7 from 3 to 7 | |||
move 5 from 9 to 6 | |||
move 22 from 6 to 8 | |||
move 2 from 6 to 5 | |||
move 2 from 8 to 4 | |||
move 14 from 8 to 7 | |||
move 11 from 7 to 4 | |||
move 3 from 8 to 1 | |||
move 9 from 7 to 8 | |||
move 10 from 1 to 4 | |||
move 1 from 7 to 4 | |||
move 4 from 8 to 7 | |||
move 6 from 4 to 9 | |||
move 7 from 4 to 1 | |||
move 3 from 4 to 8 | |||
move 1 from 5 to 8 | |||
move 8 from 5 to 3 | |||
move 4 from 3 to 9 | |||
move 7 from 8 to 9 | |||
move 3 from 8 to 3 | |||
move 2 from 8 to 2 | |||
move 7 from 9 to 1 | |||
move 2 from 2 to 8 | |||
move 8 from 9 to 1 | |||
move 8 from 1 to 7 | |||
move 7 from 1 to 5 | |||
move 7 from 7 to 1 | |||
move 11 from 9 to 8 | |||
move 9 from 8 to 5 | |||
move 2 from 8 to 5 | |||
move 3 from 1 to 8 | |||
move 2 from 3 to 7 | |||
move 6 from 4 to 1 | |||
move 6 from 1 to 6 | |||
move 5 from 7 to 1 | |||
move 2 from 4 to 6 | |||
move 1 from 3 to 5 | |||
move 4 from 7 to 4 | |||
move 2 from 8 to 7 | |||
move 10 from 5 to 6 | |||
move 9 from 6 to 1 | |||
move 8 from 1 to 6 | |||
move 1 from 7 to 2 | |||
move 9 from 6 to 4 | |||
move 2 from 4 to 3 | |||
move 3 from 8 to 1 | |||
move 1 from 2 to 4 | |||
move 4 from 4 to 1 | |||
move 7 from 4 to 3 | |||
move 3 from 3 to 2 | |||
move 1 from 7 to 6 | |||
move 9 from 6 to 7 | |||
move 6 from 7 to 4 | |||
move 2 from 7 to 2 | |||
move 6 from 4 to 7 | |||
move 2 from 2 to 9 | |||
move 1 from 2 to 4 | |||
move 1 from 7 to 4 | |||
move 4 from 7 to 6 | |||
move 4 from 5 to 4 | |||
move 1 from 2 to 5 | |||
move 1 from 7 to 5 | |||
move 1 from 2 to 6 | |||
move 6 from 4 to 3 | |||
move 9 from 3 to 9 | |||
move 4 from 6 to 2 | |||
move 7 from 3 to 8 | |||
move 22 from 1 to 7 | |||
move 1 from 1 to 7 | |||
move 2 from 8 to 3 | |||
move 4 from 5 to 6 | |||
move 2 from 3 to 2 | |||
move 6 from 2 to 8 | |||
move 3 from 8 to 6 | |||
move 1 from 4 to 8 | |||
move 1 from 1 to 8 | |||
move 8 from 6 to 7 | |||
move 7 from 8 to 9 | |||
move 22 from 7 to 4 | |||
move 3 from 5 to 6 | |||
move 1 from 8 to 1 | |||
move 2 from 8 to 2 | |||
move 3 from 6 to 4 | |||
move 1 from 1 to 3 | |||
move 15 from 9 to 1 | |||
move 5 from 1 to 5 | |||
move 3 from 7 to 6 | |||
move 5 from 5 to 6 | |||
move 4 from 4 to 3 | |||
move 6 from 6 to 9 | |||
move 7 from 7 to 6 | |||
move 5 from 6 to 7 | |||
move 4 from 1 to 9 | |||
move 3 from 7 to 4 | |||
move 2 from 9 to 7 | |||
move 5 from 3 to 5 | |||
move 3 from 6 to 3 | |||
move 5 from 4 to 6 | |||
move 10 from 9 to 5 | |||
move 1 from 2 to 9 | |||
move 1 from 3 to 5 | |||
move 1 from 2 to 9 | |||
move 3 from 1 to 6 | |||
move 2 from 9 to 2 | |||
move 7 from 6 to 5 | |||
move 15 from 4 to 9 | |||
move 2 from 4 to 5 | |||
move 1 from 3 to 4 | |||
move 9 from 9 to 1 | |||
move 1 from 9 to 2 | |||
move 2 from 9 to 4 | |||
move 11 from 5 to 4 | |||
move 1 from 9 to 3 | |||
move 1 from 6 to 8 | |||
move 4 from 7 to 8 | |||
move 4 from 8 to 9 | |||
move 15 from 4 to 7 | |||
move 1 from 6 to 7 | |||
move 1 from 3 to 7 | |||
move 6 from 9 to 6 | |||
move 1 from 3 to 7 | |||
move 1 from 2 to 1 | |||
move 1 from 9 to 5 | |||
move 3 from 6 to 1 | |||
move 11 from 1 to 4 | |||
move 6 from 5 to 1 | |||
move 2 from 2 to 5 | |||
move 1 from 5 to 7 | |||
move 2 from 6 to 1 | |||
move 7 from 5 to 7 | |||
move 3 from 5 to 6 | |||
move 4 from 6 to 1 | |||
move 11 from 4 to 3 | |||
move 1 from 8 to 5 | |||
move 23 from 7 to 6 | |||
move 18 from 6 to 9 | |||
move 1 from 5 to 9 | |||
move 1 from 4 to 2 | |||
move 3 from 3 to 7 | |||
move 3 from 3 to 8 | |||
move 17 from 1 to 8 | |||
move 5 from 6 to 5 | |||
move 2 from 7 to 1 | |||
move 20 from 8 to 2 | |||
move 4 from 7 to 2 | |||
move 3 from 9 to 5 | |||
move 7 from 9 to 7 | |||
move 6 from 9 to 2 | |||
move 1 from 1 to 8 | |||
move 3 from 9 to 4 | |||
move 7 from 5 to 2 | |||
move 6 from 7 to 1 | |||
move 1 from 1 to 8 | |||
move 3 from 2 to 6 | |||
move 1 from 7 to 6 | |||
move 2 from 8 to 9 | |||
move 35 from 2 to 4 | |||
move 3 from 3 to 2 | |||
move 1 from 5 to 7 | |||
move 2 from 3 to 9 | |||
move 3 from 1 to 6 | |||
move 2 from 2 to 1 | |||
move 32 from 4 to 7 | |||
move 3 from 4 to 8 | |||
move 3 from 9 to 5 | |||
move 1 from 1 to 2 | |||
move 21 from 7 to 5 | |||
move 2 from 2 to 1 | |||
move 3 from 1 to 2 | |||
move 15 from 5 to 1 | |||
move 3 from 6 to 7 | |||
move 3 from 4 to 6 | |||
move 3 from 8 to 5 | |||
move 1 from 9 to 3 | |||
move 8 from 7 to 2 | |||
move 6 from 5 to 2 | |||
move 9 from 1 to 6 | |||
move 4 from 7 to 1 | |||
move 2 from 5 to 4 | |||
move 2 from 4 to 3 | |||
move 3 from 5 to 4 | |||
move 17 from 2 to 7 | |||
move 3 from 3 to 5 | |||
move 2 from 4 to 8 | |||
move 1 from 4 to 3 | |||
move 5 from 7 to 9 | |||
move 1 from 3 to 6 | |||
move 4 from 1 to 7 | |||
move 4 from 6 to 7 | |||
move 2 from 5 to 2 | |||
move 1 from 1 to 3 | |||
move 10 from 6 to 4 | |||
move 1 from 3 to 7 | |||
move 20 from 7 to 8 | |||
move 8 from 4 to 8 | |||
move 1 from 2 to 8 | |||
move 4 from 9 to 1 | |||
move 3 from 7 to 4 | |||
move 2 from 4 to 9 | |||
move 2 from 6 to 3 | |||
move 1 from 2 to 8 | |||
move 1 from 7 to 6 | |||
move 1 from 9 to 5 | |||
move 3 from 5 to 9 | |||
move 4 from 9 to 2 | |||
move 1 from 4 to 5 | |||
move 1 from 5 to 3 | |||
move 3 from 2 to 4 | |||
move 1 from 9 to 7 | |||
move 1 from 2 to 1 | |||
move 1 from 7 to 1 | |||
move 11 from 1 to 2 | |||
move 3 from 1 to 7 | |||
move 25 from 8 to 5 | |||
move 1 from 6 to 3 | |||
move 1 from 6 to 2 | |||
move 7 from 8 to 2 | |||
move 9 from 2 to 8 | |||
move 2 from 4 to 7 | |||
move 2 from 5 to 7 | |||
move 2 from 5 to 2 | |||
move 5 from 5 to 1 | |||
move 7 from 5 to 1 | |||
move 2 from 4 to 9 | |||
move 3 from 5 to 6 | |||
move 1 from 1 to 8 | |||
move 1 from 5 to 6 | |||
move 1 from 4 to 7 | |||
move 1 from 9 to 2 | |||
move 3 from 5 to 2 | |||
move 2 from 6 to 9 | |||
move 3 from 9 to 8 | |||
move 1 from 5 to 4 | |||
move 3 from 3 to 9 | |||
move 10 from 1 to 5 | |||
move 4 from 2 to 8 | |||
move 2 from 6 to 1 | |||
move 3 from 9 to 7 | |||
move 1 from 1 to 9 | |||
move 1 from 4 to 3 | |||
move 1 from 9 to 2 | |||
move 9 from 8 to 2 | |||
move 2 from 3 to 7 | |||
move 2 from 7 to 6 | |||
move 3 from 5 to 6 | |||
move 4 from 8 to 6 | |||
move 4 from 8 to 3 | |||
move 4 from 3 to 2 | |||
move 4 from 6 to 8 | |||
move 1 from 7 to 9 | |||
move 2 from 1 to 8 | |||
move 2 from 8 to 3 | |||
move 1 from 9 to 2 | |||
move 13 from 2 to 4 | |||
move 6 from 5 to 7 | |||
move 2 from 5 to 7 | |||
move 10 from 2 to 4 | |||
move 11 from 7 to 8 | |||
move 1 from 6 to 4 | |||
move 4 from 6 to 7 | |||
move 24 from 4 to 9 | |||
move 11 from 7 to 4 | |||
move 1 from 3 to 8 | |||
move 1 from 3 to 5 | |||
move 4 from 4 to 2 | |||
move 5 from 4 to 2 | |||
move 9 from 2 to 5 | |||
move 4 from 9 to 5 | |||
move 1 from 5 to 1 | |||
move 2 from 5 to 7 | |||
move 2 from 2 to 5 | |||
move 1 from 1 to 7 | |||
move 2 from 2 to 3 | |||
move 18 from 9 to 6 | |||
move 9 from 8 to 1 | |||
move 2 from 9 to 5 | |||
move 5 from 1 to 8 | |||
move 2 from 8 to 7 | |||
move 4 from 8 to 4 | |||
move 5 from 8 to 7 | |||
move 10 from 5 to 1 | |||
move 10 from 7 to 4 | |||
move 4 from 5 to 8 | |||
move 14 from 1 to 9 | |||
move 6 from 9 to 8 | |||
move 1 from 5 to 1 | |||
move 12 from 6 to 9 | |||
move 4 from 6 to 8 | |||
move 11 from 8 to 5 | |||
move 1 from 6 to 1 | |||
move 19 from 9 to 7 | |||
move 2 from 3 to 5 | |||
move 13 from 7 to 5 | |||
move 3 from 7 to 1 | |||
move 4 from 8 to 9 | |||
move 2 from 7 to 6 | |||
move 7 from 4 to 8 | |||
move 5 from 8 to 1 | |||
move 1 from 1 to 3 | |||
move 1 from 7 to 2 | |||
move 6 from 1 to 6 | |||
move 1 from 2 to 5 | |||
move 1 from 8 to 1 | |||
move 1 from 8 to 2 | |||
move 2 from 4 to 8 | |||
move 5 from 6 to 1 | |||
move 2 from 4 to 7 | |||
move 2 from 9 to 6 | |||
move 1 from 6 to 5 | |||
move 4 from 6 to 2 | |||
move 1 from 9 to 5 | |||
move 2 from 4 to 5 | |||
move 4 from 2 to 4 | |||
move 2 from 8 to 3 | |||
move 3 from 3 to 2 | |||
move 4 from 1 to 2 | |||
move 2 from 4 to 7 | |||
move 4 from 2 to 3 | |||
move 4 from 1 to 2 | |||
move 13 from 5 to 1 | |||
move 1 from 6 to 2 | |||
move 1 from 1 to 8 | |||
move 15 from 5 to 2 | |||
move 4 from 3 to 1 | |||
move 5 from 4 to 3 | |||
move 1 from 3 to 6 | |||
move 1 from 8 to 7 | |||
move 1 from 9 to 8 | |||
move 1 from 7 to 8 | |||
move 3 from 3 to 2 | |||
move 1 from 8 to 2 | |||
move 1 from 3 to 7 | |||
move 13 from 1 to 4 | |||
move 3 from 5 to 3 | |||
move 1 from 1 to 2 | |||
move 1 from 8 to 5 | |||
move 5 from 7 to 2 | |||
move 1 from 6 to 5 | |||
move 2 from 3 to 4 | |||
move 10 from 2 to 5 | |||
move 1 from 9 to 5 | |||
move 3 from 1 to 8 | |||
move 3 from 8 to 3 | |||
move 11 from 4 to 5 | |||
move 12 from 2 to 8 | |||
move 4 from 4 to 7 | |||
move 10 from 8 to 5 | |||
move 2 from 8 to 1 | |||
move 1 from 7 to 3 | |||
move 1 from 7 to 9 | |||
move 5 from 3 to 7 | |||
move 1 from 9 to 4 | |||
move 7 from 7 to 6 | |||
move 13 from 5 to 8 | |||
move 6 from 6 to 7 | |||
move 5 from 7 to 4 | |||
move 1 from 6 to 4 | |||
move 2 from 4 to 9 | |||
move 1 from 7 to 9 | |||
move 3 from 4 to 3 | |||
move 1 from 3 to 6 | |||
move 4 from 5 to 7 |