projects
/
advent-of-code-2021.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Day 13
[advent-of-code-2021.git]
/
day13
/
fold.sh
diff --git
a/day13/fold.sh
b/day13/fold.sh
index 83e15850e854dbbac65cdef6d144a6861c472ae1..7db1edac277556f16b304a191b76d8727420c2b7 100755
(executable)
--- a/
day13/fold.sh
+++ b/
day13/fold.sh
@@
-91,9
+91,7
@@
fold() {
if [ $x_2 -ge $max_x ]; then
offset_2=$offset_1
fi
if [ $x_2 -ge $max_x ]; then
offset_2=$offset_1
fi
- new_map+=("$dot")
- new_offset=$((($y * $new_max_x) + $x))
- new_map[$new_offset]=$((${map[$offset_1]} | ${map[$offset_2]}))
+ new_map+=($((${map[$offset_1]} | ${map[$offset_2]})))
done
done
map=("${new_map[@]}")
done
done
map=("${new_map[@]}")
@@
-120,9
+118,7
@@
fold() {
for (( x=0; x<$max_x; x++ )); do
off_1=$(($offset_1+$x))
off_2=$(($offset_2+$x))
for (( x=0; x<$max_x; x++ )); do
off_1=$(($offset_1+$x))
off_2=$(($offset_2+$x))
- new_map+=("$dot")
- new_offset=$((($y * $max_x) + $x))
- new_map[$new_offset]=$((${map[$off_1]} | ${map[$off_2]}))
+ new_map+=($((${map[$off_1]} | ${map[$off_2]})))
done
done
map=("${new_map[@]}")
done
done
map=("${new_map[@]}")