Interim commit

This commit is contained in:
Daniel Ziltener 2023-12-11 19:19:56 +01:00
parent a3cf2f7cdd
commit 47ed32253c
Signed by: zilti
GPG Key ID: B38976E82C9DAE42
1 changed files with 112 additions and 0 deletions

View File

@ -7076,6 +7076,118 @@ Find the single giant loop starting at =S=. *How many steps along the loop does
*** Quest
You quickly reach the farthest point of the loop, but the animal never emerges. Maybe its nest is *within the area enclosed by the loop*?
To determine whether it's even worth taking the time to search for such a nest, you should calculate how many tiles are contained within the loop. For example:
#+begin_example
...........
.S-------7.
.|F-----7|.
.||.....||.
.||.....||.
.|L-7.F-J|.
.|..|.|..|.
.L--J.L--J.
...........
#+end_example
The above loop encloses merely *four tiles* - the two pairs of =.= in the southwest and southeast (marked =I= below). The middle =.= tiles (marked =O= below) are *not* in the loop. Here is the same loop again with those regions marked:
#+begin_example
...........
.S-------7.
.|F-----7|.
.||OOOOO||.
.||OOOOO||.
.|L-7OF-J|.
.|II|O|II|.
.L--JOL--J.
.....O.....
#+end_example
In fact, there doesn't even need to be a full tile path to the outside for tiles to count as outside the loop - squeezing between pipes is also allowed! Here, =I= is still within the loop and =O= is still outside the loop:
#+begin_example
..........
.S------7.
.|F----7|.
.||OOOO||.
.||OOOO||.
.|L-7F-J|.
.|II||II|.
.L--JL--J.
..........
#+end_example
In both of the above examples, *=4=* tiles are enclosed by the loop.
Here's a larger example:
#+begin_example
.F----7F7F7F7F-7....
.|F--7||||||||FJ....
.||.FJ||||||||L7....
FJL7L7LJLJ||LJ.L-7..
L--J.L7...LJS7F-7L7.
....F-J..F7FJ|L7L7L7
....L7.F7||L7|.L7L7|
.....|FJLJ|FJ|F7|.LJ
....FJL-7.||.||||...
....L---J.LJ.LJLJ...
#+end_example
The above sketch has many random bits of ground, some of which are in the loop (=I=) and some of which are outside it (=O=):
#+begin_example
OF----7F7F7F7F-7OOOO
O|F--7||||||||FJOOOO
O||OFJ||||||||L7OOOO
FJL7L7LJLJ||LJIL-7OO
L--JOL7IIILJS7F-7L7O
OOOOF-JIIF7FJ|L7L7L7
OOOOL7IF7||L7|IL7L7|
OOOOO|FJLJ|FJ|F7|OLJ
OOOOFJL-7O||O||||OOO
OOOOL---JOLJOLJLJOOO
#+end_example
In this larger example, *=8=* tiles are enclosed by the loop.
Any tile that isn't part of the main loop can count as being enclosed by the loop. Here's another example with many bits of junk pipe lying around that aren't connected to the main loop at all:
#+begin_example
FF7FSF7F7F7F7F7F---7
L|LJ||||||||||||F--J
FL-7LJLJ||||||LJL-77
F--JF--7||LJLJ7F7FJ-
L---JF-JLJ.||-FJLJJ7
|F|F-JF---7F7-L7L|7|
|FFJF7L7F-JF7|JL---7
7-L-JL7||F7|L7F-7F7|
L.L7LFJ|||||FJL7||LJ
L7JLJL-JLJLJL--JLJ.L
#+end_example
Here are just the tiles that are *enclosed by the loop* marked with =I=:
#+begin_example
FF7FSF7F7F7F7F7F---7
L|LJ||||||||||||F--J
FL-7LJLJ||||||LJL-77
F--JF--7||LJLJIF7FJ-
L---JF-JLJIIIIFJLJJ7
|F|F-JF---7IIIL7L|7|
|FFJF7L7F-JF7IIL---7
7-L-JL7||F7|L7F-7F7|
L.L7LFJ|||||FJL7||LJ
L7JLJL-JLJLJL--JLJ.L
#+end_example
In this last example, *=10=* tiles are enclosed by the loop.
Figure out whether you have time to search for the nest by calculating the area within the loop. *How many tiles are enclosed by the loop?*
*** Puzzle Solution
**** Calculation