advent2021

Advent of Code 2021 Solutions
git clone git://bsandro.tech/advent2021
Log | Files | Refs

commit 548678ce56cc166d3495816095aed4049fbf7103
parent 15902a524a76bf1b66c399aac1469d9399cbc573
Author: bsandro <brian.drosan@gmail.com>
Date:   Sat, 11 Dec 2021 09:40:32 +0200

Day 10 bugfix (memory corruption)

Diffstat:
Mday01/Makefile | 1-
Mday02/Makefile | 1-
Mday03/Makefile | 1-
Mday04/Makefile | 1-
Mday05/Makefile | 1-
Mday06/Makefile | 1-
Mday07/Makefile | 1-
Mday08/Makefile | 1-
Mday09/Makefile | 1-
Mday10/Makefile | 1-
Mday10/puzzle.c | 1+
Mrun.sh | 9+++++++--
12 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/day01/Makefile b/day01/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c) DEPS:=$(wildcard *.h) OBJ:=$(SRC:.c=.o) diff --git a/day02/Makefile b/day02/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c) DEPS:=$(wildcard *.h) OBJ:=$(SRC:.c=.o) diff --git a/day03/Makefile b/day03/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c ../common/*.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day04/Makefile b/day04/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c ../common/*.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day05/Makefile b/day05/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c ../common/*.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day06/Makefile b/day06/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c) DEPS:=$(wildcard *.h) OBJ:=$(SRC:.c=.o) diff --git a/day07/Makefile b/day07/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c ../common/*.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day08/Makefile b/day08/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day09/Makefile b/day09/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day10/Makefile b/day10/Makefile @@ -1,5 +1,4 @@ NAME=$(shell basename ${PWD}) -CC=cc SRC=$(wildcard *.c ../common/*.c) DEPS:=$(wildcard *.h ../common/*.h) OBJ:=$(SRC:.c=.o) diff --git a/day10/puzzle.c b/day10/puzzle.c @@ -44,6 +44,7 @@ void puzzle(const char *filename, long long *result1, long long *result2) { if (illegal != 0) { *result1 += calc_score1(illegal); } else { + if (scores.count >= scores.cap) array_expand(&scores); ((long long *)scores.data)[scores.count++] = calc_score2(&brackets); } diff --git a/run.sh b/run.sh @@ -3,13 +3,18 @@ days=day* base=$(pwd) cmd="run" +make=${MAKE} -if [[ -n "$1" ]]; then +if [ -n "$1" ]; then cmd=$1 fi +if [ -z "$make" ]; then + make="make" +fi + for day in $days; do cd $day - make -j2 $cmd + ${make} -j2 $cmd cd $base done