summaryrefslogtreecommitdiffstats
path: root/2024/tcl/02.tcl
diff options
context:
space:
mode:
authorAleteoryx <alyx@aleteoryx.me>2024-12-03 03:53:49 -0500
committerAleteoryx <alyx@aleteoryx.me>2024-12-03 03:56:22 -0500
commit645bf066b803f6a5b62aba177f792269b92e5377 (patch)
tree65c344f818db7f3aab7b765b401c3f0dbf466fdc /2024/tcl/02.tcl
parent735b9fdf4535be1d721c59077e66def8b115d2ae (diff)
downloadadventofcode-645bf066b803f6a5b62aba177f792269b92e5377.tar.gz
adventofcode-645bf066b803f6a5b62aba177f792269b92e5377.tar.bz2
adventofcode-645bf066b803f6a5b62aba177f792269b92e5377.zip
prep
Diffstat (limited to '2024/tcl/02.tcl')
-rwxr-xr-x2024/tcl/02.tcl4
1 files changed, 1 insertions, 3 deletions
diff --git a/2024/tcl/02.tcl b/2024/tcl/02.tcl
index dac290e..8cc14f3 100755
--- a/2024/tcl/02.tcl
+++ b/2024/tcl/02.tcl
@@ -22,7 +22,7 @@ proc row_errs {row} {
return $row_errs
}
-while {[gets $input report] != -1} {
+foreach report $input {
if ![row_errs $report] { incr safe_count; continue }
# naive, but handles a case like [1 4 2 3] where removing 2 makes it
# safe but an iterative approach only trips on [2]. backtracking
@@ -37,8 +37,6 @@ while {[gets $input report] != -1} {
incr dampened_safe_count $safe_count
-close $input
-
puts "Safe sequence count: $safe_count"
puts ""