Skip to content

Commit

Permalink
remove dangling prints and dead code
Browse files Browse the repository at this point in the history
Signed-off-by: Lunik <lunik@tiwabbit.fr>
  • Loading branch information
Lunik committed Dec 10, 2023
1 parent fd85e79 commit 3124aa0
Show file tree
Hide file tree
Showing 29 changed files with 17 additions and 159 deletions.
6 changes: 5 additions & 1 deletion adventofcode/solutions/y0000/d00/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@


def parse(file):
data = []

for line in file:
print(line.strip("\n"))
data.append(line.strip("\n"))

return data


def main():
Expand Down
8 changes: 0 additions & 8 deletions adventofcode/solutions/y2020/d03/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
# l______> x


def print_map(the_map):
count = 0
for line in the_map:
print(count, "".join(line) + "".join(line))
count += 1


def parse_line(line):
return line.strip()

Expand Down Expand Up @@ -51,7 +44,6 @@ def main():
for line in file:
the_map.append(parse_line(line))

# print_map(the_map)
return verify(the_map, (3, 1))


Expand Down
8 changes: 0 additions & 8 deletions adventofcode/solutions/y2020/d05/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
)


def print_plane(plane):
count = 0
print("\t", "0 1 2 3 4 5 6 7")
for row in plane:
print(count, "\t", " ".join(row))
count += 1


def find_seat(plane):
for row in range(1, 128):
for column in range(1, 8):
Expand Down
5 changes: 0 additions & 5 deletions adventofcode/solutions/y2020/d11/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ def parse_line(line):
return list(line)


def print_waiting_room(waiting_room):
for row in waiting_room:
print("".join(row))


def get_wr_size(waiting_room):
return (len(waiting_room), len(waiting_room[0])) # y, x

Expand Down
3 changes: 0 additions & 3 deletions adventofcode/solutions/y2020/d12/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def get_distance(self):
self.navigation["E"] - self.navigation["W"]
)

def debug(self):
print(self.orientation, self.navigation)


def main():
boat = Boat("E")
Expand Down
3 changes: 0 additions & 3 deletions adventofcode/solutions/y2020/d12/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ def exec_action(self, action, value):
for direction in self.waypoint.keys():
self.navigation[direction] += self.waypoint[direction] * value

def debug(self):
print(self.waypoint, self.navigation)


def main():
boat = Boat2(dict(N=1, E=10, S=0, W=0))
Expand Down
16 changes: 0 additions & 16 deletions adventofcode/solutions/y2020/d13/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ def __init__(self, schedule):
def move(self, timestamp):
self.atStation = (timestamp % self.schedule) == 0

def debug(self):
print(
" Bus :",
self.schedule,
"\t",
" not" if not self.atStation else "",
"at station",
)


class BusCalendar:
def __init__(self, current_timestamp):
Expand All @@ -53,11 +44,6 @@ def find_bus(self):

return None

def debug(self):
print("Timestamp", self.currentTimestamp)
for bus in self.buses:
bus.debug()


def main():
with open(
Expand All @@ -72,8 +58,6 @@ def main():
bus_calendar.wait_next_timestamp()
bus_found = bus_calendar.find_bus()

# bus_calendar.debug()

return (bus_calendar.currentTimestamp - start_time) * bus_found.schedule


Expand Down
7 changes: 0 additions & 7 deletions adventofcode/solutions/y2020/d17/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ def parse_data(y_len, x_len, data):
return first_slice


def print_dimension(dimension):
for pos_z, dimension_z in enumerate(dimension):
print("z=", pos_z)
for _, dimension_y in enumerate(dimension_z):
print(" ".join(dimension_y))


def find_neighbors(position, dimension):
neighbors = []

Expand Down
8 changes: 0 additions & 8 deletions adventofcode/solutions/y2020/d17/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ def parse_data(y_len, x_len, data):
return first_slice


def print_dimension(dimension):
for pos_w, dimension_w in enumerate(dimension):
for pos_z, dimension_z in enumerate(dimension_w):
print("w=", pos_w, "z=", pos_z)
for _, dimension_y in enumerate(dimension_z):
print(" ".join(dimension_y))


def find_neighbors(position, dimension):
neighbors = []

Expand Down
7 changes: 0 additions & 7 deletions adventofcode/solutions/y2021/d04/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ def parse(data):
return winning_numbers, grids


def debug_grid(grid):
print("=======")
for line in grid:
print(line)
print("=======")


def check_number(grid, number):
for line in grid:
for current_number in filter(
Expand Down
1 change: 0 additions & 1 deletion adventofcode/solutions/y2021/d08/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def find_digits_string(digits, sequences):


def solve(sequence):
# print("solve ==>", sequence)
digits = {
0: None,
1: None,
Expand Down
5 changes: 0 additions & 5 deletions adventofcode/solutions/y2021/d09/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ def parse(file):
return [list(line.rstrip("\n")) for line in file]


def debug_grid(grid):
for line in grid:
print(" ".join(line))


def get_neighbour(position):
return [
(position[0] - 1, position[1]),
Expand Down
3 changes: 0 additions & 3 deletions adventofcode/solutions/y2021/d10/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def __init__(self, message, char):

def check_line(line):
counter = ""
# print(f"\nline: {line}")
for char in list(line):
if char in "({[<":
counter += char
Expand All @@ -43,10 +42,8 @@ def solve(line):
try:
check_line(line)
except ExpectingChar as _:
# print(_)
return INVALID_CHAR_POINTS[_.char]

# print("is valid")
return 0


Expand Down
3 changes: 0 additions & 3 deletions adventofcode/solutions/y2021/d10/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __init__(self, message, chars):

def check_line(line):
counter = []
# print(f"\nline: {line}")
for char in list(line):
if char in "({[<":
counter += char
Expand Down Expand Up @@ -46,10 +45,8 @@ def solve(line):
try:
check_line(line)
except ExpectingChar as _:
# print(_)
pass
except MissingChars as _:
# print(_)
for char in _.chars:
result = (result * 5) + MISSING_CHAR_POINTS[char]

Expand Down
5 changes: 0 additions & 5 deletions adventofcode/solutions/y2021/d11/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ def parse(file):
return data


def print_grid(grid):
for line in grid:
print(" ".join([str(x) for x in line]))


def charge_octopus(grid):
for idy, line in enumerate(grid):
for idx, _ in enumerate(line):
Expand Down
7 changes: 0 additions & 7 deletions adventofcode/solutions/y2021/d12/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ def parse(file):
return cave


def debug_cave(cave):
for node, neighbors in cave.items():
print(node, neighbors)


def find_path(cave, node="start", path=[]):
p = copy(path)
p.append(node)
Expand Down Expand Up @@ -70,8 +65,6 @@ def main():
) as file:
cave = parse(file)

# debug_cave(cave)

res = find_path(cave)

return len(res)
Expand Down
2 changes: 1 addition & 1 deletion adventofcode/solutions/y2021/d12/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
from copy import copy

from adventofcode.solutions.y2021.d12.part1 import parse, debug_cave
from adventofcode.solutions.y2021.d12.part1 import parse


def find_path(cave, selected_small_cave, node="start", path=[]):
Expand Down
5 changes: 0 additions & 5 deletions adventofcode/solutions/y2021/d13/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ def fold(matrix, line, value):
return new_matrix


def print_matrix(matrix):
for line in matrix:
print("".join(["#" if x else " " for x in line]))


def count_dots(matrix):
return sum(map(sum, matrix))

Expand Down
5 changes: 1 addition & 4 deletions adventofcode/solutions/y2021/d13/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import cProfile
import pstats

from adventofcode.solutions.y2021.d13.part1 import parse, fold, count_dots, print_matrix
from adventofcode.solutions.y2021.d13.part1 import parse, fold, count_dots


def main():
Expand All @@ -14,9 +14,6 @@ def main():
for line, value in fold_instructions:
matrix = fold(matrix, line, value)

print("")
print_matrix(matrix)

return matrix


Expand Down
7 changes: 0 additions & 7 deletions adventofcode/solutions/y2021/d15/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ def parse(file):
return matrix


def print_matrix(matrix):
m = deepcopy(matrix)

for line in m:
print("".join(map(str, line)))


def get_neighbors(pos, maxs):
neighbors = list(
filter(
Expand Down
2 changes: 1 addition & 1 deletion adventofcode/solutions/y2021/d15/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import cProfile
import pstats

from adventofcode.solutions.y2021.d15.part1 import find_path, print_matrix
from adventofcode.solutions.y2021.d15.part1 import find_path


def parse(file):
Expand Down
5 changes: 0 additions & 5 deletions adventofcode/solutions/y2022/d05/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ def solve(matrix, instructions):
return res


def print_matrix(matrix):
for row in matrix:
print(" ".join(row))


def main():
with open(
os.path.join(os.path.dirname(__file__), "input.txt"), "r", encoding="UTF-8"
Expand Down
7 changes: 0 additions & 7 deletions adventofcode/solutions/y2022/d07/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ def parse(file):
return tree


def print_tree(tree, prof=0):
print(" " * prof, tree[1], tree[2])
if tree[0] == "d":
for child in tree[3]:
print_tree(child, prof + 1)


def get_size(tree):
if tree[0] == "f":
return tree[2]
Expand Down
3 changes: 0 additions & 3 deletions adventofcode/solutions/y2022/d10/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def main():

result = solve(data)

for line in result:
print("".join(line))

return result


Expand Down
5 changes: 0 additions & 5 deletions adventofcode/solutions/y2022/d12/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ def find_path(matrix, start, end):
q.put((new_path_distange, (new_path_distange, neighbor)))


def print_matrix(matrix):
for line in matrix:
print("".join(line))


def main():
with open(
os.path.join(os.path.dirname(__file__), "input.txt"), "r", encoding="UTF-8"
Expand Down
16 changes: 0 additions & 16 deletions adventofcode/solutions/y2022/d14/part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,6 @@ def solve(data, start):
return sand_count


def print_data(data):
range_x = [p[0] for p in data.keys()]
range_y = [p[1] for p in data.keys()]

for y in range(min(range_y), max(range_y) + 1):
line = []

for x in range(min(range_x), max(range_x) + 1):
if (x, y) in data:
line.append(data[(x, y)])
else:
line.append(".")

print("".join(line))


def main():
with open(
os.path.join(os.path.dirname(__file__), "input.txt"), "r", encoding="UTF-8"
Expand Down
2 changes: 1 addition & 1 deletion adventofcode/solutions/y2022/d14/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pstats
from copy import copy

from adventofcode.solutions.y2022.d14.part1 import parse, print_data
from adventofcode.solutions.y2022.d14.part1 import parse


def check_move(sand, data, floor):
Expand Down
Loading

0 comments on commit 3124aa0

Please sign in to comment.