summaryrefslogtreecommitdiffstats
path: root/2024/tcl/03.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/03.tcl
parent735b9fdf4535be1d721c59077e66def8b115d2ae (diff)
downloadadventofcode-645bf066b803f6a5b62aba177f792269b92e5377.tar.gz
adventofcode-645bf066b803f6a5b62aba177f792269b92e5377.tar.bz2
adventofcode-645bf066b803f6a5b62aba177f792269b92e5377.zip
prep
Diffstat (limited to '2024/tcl/03.tcl')
-rwxr-xr-x2024/tcl/03.tcl6
1 files changed, 2 insertions, 4 deletions
diff --git a/2024/tcl/03.tcl b/2024/tcl/03.tcl
index d1ff7c9..7f29b9a 100755
--- a/2024/tcl/03.tcl
+++ b/2024/tcl/03.tcl
@@ -1,14 +1,14 @@
#!/bin/env tclsh
source lib.tcl
-setup 3
+setup 3 data
puts {Part 1: Sum of mul(x,y) calls...}
set mulsum 0
set mulsum_cf 0
set cf 1
-foreach {inst a b} [regexp -all -inline {do\(\)|don't\(\)|mul\((\d+),(\d+)\)} [read $input]] {
+foreach {inst a b} [regexp -all -inline {do\(\)|don't\(\)|mul\((\d+),(\d+)\)} $input] {
switch -- [string range $inst 0 2] {
mul {
set inc [expr {$a * $b}]
@@ -26,8 +26,6 @@ foreach {inst a b} [regexp -all -inline {do\(\)|don't\(\)|mul\((\d+),(\d+)\)} [r
}
}
-close $input
-
puts "Sum: $mulsum"
puts ""