diff --git a/2022/day09/Makefile b/2022/day09/Makefile new file mode 100644 index 0000000..e0add74 --- /dev/null +++ b/2022/day09/Makefile @@ -0,0 +1,111 @@ +# AOC daily Makefile - GNU make only. +# +# Copyright (C) 2021-2022 Bruno Raoult ("br") +# Licensed under the GNU General Public License v3.0 or later. +# Some rights reserved. See COPYING. +# +# You should have received a copy of the GNU General Public License along with this +# program. If not, see . +# +# SPDX-License-Identifier: GPL-3.0-or-later +# + +INPUT := input/input.txt +SHELL := /bin/bash + +CC := gcc +BEAR := bear +CCLSFILE:= compile_commands.json + +LIB := aoc_$(shell uname -m) +INCDIR := ../include +LIBDIR := ../lib +LDFLAGS := -L$(LIBDIR) +#LDLIB := -l$(LIB) -lm +LDLIB := -l$(LIB) + +export LD_LIBRARY_PATH = $(LIBDIR) + +CFLAGS += -std=gnu11 +CFLAGS += -O2 +CFLAGS += -g +# for gprof +# CFLAGS += -pg +CFLAGS += -Wall +CFLAGS += -Wextra +CFLAGS += -march=native +# Next one may be useful for valgrind (some invalid instructions) +# CFLAGS += -mno-tbm +CFLAGS += -Wmissing-declarations +CFLAGS += -Wno-unused-result + +CFLAGS += -DDEBUG_DEBUG # activate general debug (debug.c) +CFLAGS += -DDEBUG_POOL # memory pools management + +VALGRIND := valgrind +VALGRINDFLAGS := --leak-check=full --show-leak-kinds=all --track-origins=yes \ + --sigill-diagnostics=yes --quiet --show-error-list=yes + + +TIME := \time -f "\ttime: %E real, %U user, %S sys\n\tcontext-switch:\t%c+%w, page-faults: %F+%R\n" +export PATH := .:$(PATH) + +.PHONY: clean all compile assembly memcheck memcheck1 memcheck2 part1 part2 ccls bear org + +all: README.org ccls part1 part2 + +memcheck: memcheck1 memcheck2 + +memcheck1: aoc-c + @$(VALGRIND) $(VALGRINDFLAGS) aoc-c -p 1 < $(INPUT) + +memcheck2: aoc-c + @$(VALGRIND) $(VALGRINDFLAGS) aoc-c -p 2 < $(INPUT) + @#@valgrind -s --track-origins=yes aoc-c -p 2 < $(INPUT) + +compile: aoc-c + +cpp: aoc-c.i + +assembly: aoc-c.s + +part1: aoc-c + @$(TIME) aoc.bash -p 1 < $(INPUT) 2>&1 + @$(TIME) aoc-c -p 1 < $(INPUT) + +part2: aoc-c + @$(TIME) aoc.bash -p 2 < $(INPUT) 2>&1 + @$(TIME) aoc-c -p 2 < $(INPUT) + +ccls: $(CCLSFILE) + +clean: + @rm -f aoc-c core* vgcore* gmon.out aoc-c.s aoc-c.i README.html compile_commands.json + +aoc-c: aoc-c.c common.c + @echo compiling $< + $(CC) $(CFLAGS) $(LDFLAGS) -I $(INCDIR) $^ $(LDLIB) -o $@ + +# generate pre-processed file (.i) and assembler (.s) +%.i: %.c + @echo generating $@ + @$(CC) -E $(CFLAGS) -I $(INCDIR) $< -o $@ + +%.s: %.c + @echo generating $@ + @$(CC) -S -fverbose-asm $(CFLAGS) -I $(INCDIR) $< -o $@ + +# generate README.org from README.html (must cleanup !) +org: README.org + +%.org: %.html + @echo generating $@. Cleanup before commit ! + @pandoc $< -o $@ + +# generate compile_commands.json +$(CCLSFILE): aoc-c.c Makefile + $(BEAR) -- make clean compile + +bear: clean + @touch .ccls-root + @$(BEAR) -- make compile diff --git a/2022/day09/README.org b/2022/day09/README.org new file mode 100644 index 0000000..cfe6fd3 --- /dev/null +++ b/2022/day09/README.org @@ -0,0 +1,285 @@ +** --- Day 9: Rope Bridge --- +This rope bridge creaks as you walk along it. You aren't sure how old it +is, or whether it can even support your weight. + +It seems to support the Elves just fine, though. The bridge spans a +gorge which was carved out by the massive river far below you. + +You step carefully; as you do, the ropes stretch and twist. You decide +to distract yourself by modeling rope physics; maybe you can even figure +out where /not/ to step. + +Consider a rope with a knot at each end; these knots mark the /head/ and +the /tail/ of the rope. If the head moves far enough away from the tail, +the tail is pulled toward the head. + +Due to nebulous reasoning involving +[[https://en.wikipedia.org/wiki/Planck_units#Planck_length][Planck +lengths]], you should be able to model the positions of the knots on a +two-dimensional grid. Then, by following a hypothetical /series of +motions/ (your puzzle input) for the head, you can determine how the +tail will move. + +Due to the aforementioned Planck lengths, the rope must be quite short; +in fact, the head (=H=) and tail (=T=) must /always be touching/ +(diagonally adjacent and even overlapping both count as touching): + +#+begin_example +.... +.TH. +.... + +.... +.H.. +..T. +.... + +... +.H. (H covers T) +... +#+end_example + +If the head is ever two steps directly up, down, left, or right from the +tail, the tail must also move one step in that direction so it remains +close enough: + +#+begin_example +..... ..... ..... +.TH.. -> .T.H. -> ..TH. +..... ..... ..... + +... ... ... +.T. .T. ... +.H. -> ... -> .T. +... .H. .H. +... ... ... +#+end_example + +Otherwise, if the head and tail aren't touching and aren't in the same +row or column, the tail always moves one step diagonally to keep up: + +#+begin_example +..... ..... ..... +..... ..H.. ..H.. +..H.. -> ..... -> ..T.. +.T... .T... ..... +..... ..... ..... + +..... ..... ..... +..... ..... ..... +..H.. -> ...H. -> ..TH. +.T... .T... ..... +..... ..... ..... +#+end_example + +You just need to work out where the tail goes as the head follows a +series of motions. Assume the head and the tail both start at the same +position, overlapping. + +For example: + +#+begin_example +R 4 +U 4 +L 3 +D 1 +R 4 +D 1 +L 5 +R 2 +#+end_example + +This series of motions moves the head /right/ four steps, then /up/ four +steps, then /left/ three steps, then /down/ one step, and so on. After +each step, you'll need to update the position of the tail if the step +means the head is no longer adjacent to the tail. Visually, these +motions occur as follows (=s= marks the starting position as a reference +point): + +#+begin_example +== Initial State == + +...... +...... +...... +...... +H..... (H covers T, s) + +== R 4 == + +...... +...... +...... +...... +TH.... (T covers s) + +...... +...... +...... +...... +sTH... + +...... +...... +...... +...... +s.TH.. + +...... +...... +...... +...... +s..TH. + +== U 4 == + +...... +...... +...... +....H. +s..T.. + +...... +...... +....H. +....T. +s..... + +...... +....H. +....T. +...... +s..... + +....H. +....T. +...... +...... +s..... + +== L 3 == + +...H.. +....T. +...... +...... +s..... + +..HT.. +...... +...... +...... +s..... + +.HT... +...... +...... +...... +s..... + +== D 1 == + +..T... +.H.... +...... +...... +s..... + +== R 4 == + +..T... +..H... +...... +...... +s..... + +..T... +...H.. +...... +...... +s..... + +...... +...TH. +...... +...... +s..... + +...... +....TH +...... +...... +s..... + +== D 1 == + +...... +....T. +.....H +...... +s..... + +== L 5 == + +...... +....T. +....H. +...... +s..... + +...... +....T. +...H.. +...... +s..... + +...... +...... +..HT.. +...... +s..... + +...... +...... +.HT... +...... +s..... + +...... +...... +HT.... +...... +s..... + +== R 2 == + +...... +...... +.H.... (H covers T) +...... +s..... + +...... +...... +.TH... +...... +s..... +#+end_example + +After simulating the rope, you can count up all of the positions the +/tail visited at least once/. In this diagram, =s= again marks the +starting position (which the tail also visited) and =#= marks other +positions the tail visited: + +#+begin_example +..##.. +...##. +.####. +....#. +s###.. +#+end_example + +So, there are =13= positions the tail visited at least once. + +Simulate your complete hypothetical series of motions. /How many +positions does the tail of the rope visit at least once?/ diff --git a/2022/day09/aoc.h b/2022/day09/aoc.h new file mode 100644 index 0000000..2ef8361 --- /dev/null +++ b/2022/day09/aoc.h @@ -0,0 +1,17 @@ +/* aoc.c: Advent of Code 2022 + * + * Copyright (C) 2022 Bruno Raoult ("br") + * Licensed under the GNU General Public License v3.0 or later. + * Some rights reserved. See COPYING. + * + * You should have received a copy of the GNU General Public License along with this + * program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ +#ifndef _AOC_H_ +#define _AOC_H_ + +extern int parseargs(int ac, char**av); + +#endif /* _AOC_H_ */ diff --git a/2022/day09/common.bash b/2022/day09/common.bash new file mode 100755 index 0000000..5af1e54 --- /dev/null +++ b/2022/day09/common.bash @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# +# common.bash: Advent of Code 2022, common bash functions +# +# Copyright (C) 2022 Bruno Raoult ("br") +# Licensed under the GNU General Public License v3.0 or later. +# Some rights reserved. See COPYING. +# +# You should have received a copy of the GNU General Public License along with this +# program. If not, see . +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck disable=2034 +export cmdname=${0##*/} +export debug=0 +export res +export LANG=C + +shopt -s extglob +set -o noglob + +usage() { + printf "usage: %s [-d DEBUG] [-p PART]\n" "$cmdname" + exit 1 +} + +checkargs() { + local part=1 + while getopts p:d: todo; do + case "$todo" in + d) + if [[ "$OPTARG" =~ ^[[:digit:]+]$ ]]; then + debug="$OPTARG" + else + printf "%s: illegal [%s] debug level.\n" "$CMD" "$OPTARG" + exit 1 + fi + ;; + p) + if [[ "$OPTARG" =~ ^[12]$ ]]; then + part="$OPTARG" + else + printf "%s: illegal [%s] part.\n" "$CMD" "$OPTARG" + exit 1 + fi + ;; + *) + usage + ;; + esac + done + # Now check remaining argument (backup directory) + shift $((OPTIND - 1)) + + (( $# > 1 )) && usage + return "$part" +} + +main() { + local -i part + + checkargs "$@" + part=$? + parse "$part" + solve "$part" + printf "%s: res=%s\n" "$cmdname" "$res" +} diff --git a/2022/day09/common.c b/2022/day09/common.c new file mode 100644 index 0000000..a3827b6 --- /dev/null +++ b/2022/day09/common.c @@ -0,0 +1,49 @@ +/* common.c: Advent of Code 2022, common functions + * + * Copyright (C) 2022 Bruno Raoult ("br") + * Licensed under the GNU General Public License v3.0 or later. + * Some rights reserved. See COPYING. + * + * You should have received a copy of the GNU General Public License along with this + * program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include +#include + +#include "aoc.h" +#include "debug.h" + +static int usage(char *prg) +{ + fprintf(stderr, "Usage: %s [-d debug_level] [-p part] [-i input]\n", prg); + return 1; +} + +int parseargs(int ac, char **av) +{ + int opt, part = 1; + + while ((opt = getopt(ac, av, "d:p:")) != -1) { + switch (opt) { + case 'd': + debug_level_set(atoi(optarg)); + break; + case 'p': /* 1 or 2 */ + part = atoi(optarg); + if (part < 1 || part > 2) + return usage(*av); + break; + case 'i': + + default: + return usage(*av); + } + } + if (optind < ac) + return usage(*av); + return part; +} diff --git a/2022/day09/input/example.txt b/2022/day09/input/example.txt new file mode 100644 index 0000000..9874df2 --- /dev/null +++ b/2022/day09/input/example.txt @@ -0,0 +1,8 @@ +R 4 +U 4 +L 3 +D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