advent2025

Advent of Code 2025 Solutions
git clone git://bsandro.tech/advent2025
Log | Files | Refs | LICENSE

commit 25c5cdae5e6851c0473fc24f59ba668686d52e53
parent f699d90224cd32750520247f2de2979d6272f9b2
Author: bsandro <email@bsandro.tech>
Date:   Wed, 10 Dec 2025 01:53:10 +0200

day09 cleanup

Diffstat:
Mday09.c | 13++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/day09.c b/day09.c @@ -49,6 +49,7 @@ static bool square_has_points(int points_l, Point points[points_l], Point p1, Po return false; } +// essentially check for ovelaps in lines static bool square_is_valid(int lines_l, Line lines[lines_l], Point p1, Point p2) { Point p3 = (Point){ .x=p1.x, .y=p2.y }; Point p4 = (Point){ .x=p2.x, .y=p1.y }; @@ -67,20 +68,14 @@ static bool square_is_valid(int lines_l, Line lines[lines_l], Point p1, Point p2 (p3.x==lx2&&p3.y==ly2)|| (p4.x==lx1&&p4.y==ly1)|| (p4.x==lx2&&p4.y==ly2)|| - (p1.x==lx1&&p1.y==ly1)|| (p1.x==lx2&&p1.y==ly2)|| (p2.x==lx1&&p2.y==ly1)|| (p2.x==lx2&&p2.y==ly2) - ) continue; - if (lx1<=x1&&lx2>=x2&&ly1>=y1&&ly2<=y2) { - return false; - } - if (ly1<=y1&&ly2>=y2&&lx1>=x1&&lx2<=x2) { - return false; - } + ) continue; // skip checking lines that connected directly to those points + if (lx1<=x1&&lx2>=x2&&ly1>=y1&&ly2<=y2) return false; + if (ly1<=y1&&ly2>=y2&&lx1>=x1&&lx2<=x2) return false; } - return true; }