Remove debug printing from day 8's Crystal
This commit is contained in:
parent
874716448e
commit
99ba049301
4
day8.cr
4
day8.cr
|
@ -16,7 +16,6 @@ def score(arr, x, y, dx, dy)
|
||||||
y += dy
|
y += dy
|
||||||
end
|
end
|
||||||
count += 1 if (x >= 0 && x < arr.size && y >= 0 && y < arr[x].size)
|
count += 1 if (x >= 0 && x < arr.size && y >= 0 && y < arr[x].size)
|
||||||
puts ({dx, dy, count}).to_s
|
|
||||||
count
|
count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +30,6 @@ def part1(input)
|
||||||
y += 1
|
y += 1
|
||||||
tree = input[x][y]
|
tree = input[x][y]
|
||||||
if visible_in_row(input[x], y) || visible_in_row(input_t[y], x)
|
if visible_in_row(input[x], y) || visible_in_row(input_t[y], x)
|
||||||
puts ({x, y, tree}).to_s
|
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,11 +42,9 @@ def part2(input)
|
||||||
(input.size - 0).times do |x|
|
(input.size - 0).times do |x|
|
||||||
(input[x].size - 0).times do |y|
|
(input[x].size - 0).times do |y|
|
||||||
tree_score = score(input, x, y, 1, 0) * score(input, x, y, -1, 0) * score(input, x, y, 0, 1) * score(input, x, y, 0, -1)
|
tree_score = score(input, x, y, 1, 0) * score(input, x, y, -1, 0) * score(input, x, y, 0, 1) * score(input, x, y, 0, -1)
|
||||||
puts ({x, y, input[x][y], tree_score}).to_s
|
|
||||||
if tree_score > best
|
if tree_score > best
|
||||||
best = tree_score
|
best = tree_score
|
||||||
end
|
end
|
||||||
puts "--"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
best
|
best
|
||||||
|
|
Loading…
Reference in New Issue
Block a user