summaryrefslogtreecommitdiffstats
path: root/day3/day3-1.js
diff options
context:
space:
mode:
authorGravatar Piotr Russ <piotr.russ@betvictor.com> 2020-12-07 22:53:36 +0100
committerGravatar Piotr Russ <piotr.russ@betvictor.com> 2020-12-07 22:53:36 +0100
commit3700a9063725b001267730d6586d9cf905476cbb (patch)
treeea80cec1f3c24a940abf0527981625bec08a46e8 /day3/day3-1.js
parent5e34312e42721aae0d8919df7ef31ffaff435555 (diff)
downloadadvent_of_code_2020-3700a9063725b001267730d6586d9cf905476cbb.tar.gz
advent_of_code_2020-3700a9063725b001267730d6586d9cf905476cbb.tar.bz2
advent_of_code_2020-3700a9063725b001267730d6586d9cf905476cbb.zip
day3
Diffstat (limited to 'day3/day3-1.js')
-rw-r--r--day3/day3-1.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/day3/day3-1.js b/day3/day3-1.js
new file mode 100644
index 0000000..401ac7f
--- /dev/null
+++ b/day3/day3-1.js
@@ -0,0 +1,9 @@
+const data = require('./data')
+
+let trees = 0;
+data.forEach((line, i) => {
+ line[(3 * i)%line.length] === "#" && (trees += 1)
+})
+
+console.log(trees)
+