# 2026 Day 3: Foggy Forest

**URL:** <https://forum.ada-lang.io/t/2026-day-3-foggy-forest/5031>\
**Category:** Advent of Code\
**Created:** [December 3, 2026, 7:33am UTC](https://forum.ada-lang.io/t/2026-day-3-foggy-forest/5031 "2026-12-03T07:33:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeremyGrosser](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/jeremygrosser/32/3_2.png) [@JeremyGrosser](https://forum.ada-lang.io/u/JeremyGrosser)\
**Post date:** [December 3, 2026, 7:33am UTC](https://forum.ada-lang.io/t/2026-day-3-foggy-forest/5031/1 "2026-12-03T07:33:19Z")

</div>

Part 2 got me pretty confused. I admit I resorted to asking Claude for algorithmic hints, though explicitly told it not to give me direct answers or code. I was on the right track, but off by one errors will ruin your day.

> <https://github.com/JeremyGrosser/advent/blob/c6b1b58551d9a64f02ac670f196291a7440ea3fe/2026/day3/src/day3.adb>

---

<div class="post-metadata">

**Author:** ![jcmoyer](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/jcmoyer/32/373_2.png) [@jcmoyer](https://forum.ada-lang.io/u/jcmoyer)\
**Post date:** [December 3, 2026, 10:05am UTC](https://forum.ada-lang.io/t/2026-day-3-foggy-forest/5031/2 "2026-12-03T10:05:42Z")

</div>

For this one I take all pairs of trees (P,Q) and try to trace a complete square using the vector between P and Q.

Q - P gives you the vector that moves along one side of the square from P to Q. If you rotate that vector 90 degrees and add it to Q, you should end up at another corner on the square. If you repeat this process 4 times and land on a tree every time, you have a complete square.

---

<div class="post-metadata">

**Author:** ![ZenitDS](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/zenitds/32/949_2.png) [@ZenitDS](https://forum.ada-lang.io/u/ZenitDS)\
**Post date:** [December 3, 2026, 11:50am UTC](https://forum.ada-lang.io/t/2026-day-3-foggy-forest/5031/3 "2026-12-03T11:50:35Z")

</div>

Today I just went dirty, brute forcing with a `O(n^3)` for part 1 and `O(n^4)` for part 2. Going through all the possibilities and seeing if that is a valid square. I had to make sure no duplicates were considered.
