
                     the pyug.at X-Mas Puzzle, 2022 Edition

                          ,-------------------------,
           --- === ===== <   The Little Tracer Boy   > ===== === ---
                          '-------------------------'
                              Py rum pum pum pum?!


    So, we made it this far -- 2022. A lot has happened this year.

    In May, we were able to finally meetup together again in-person after
    more than two years of mostly-pandemic Jitsi-ness, and since this
    September, we're back on schedule for monthly meetings at the Metalab.

    October was a great month for performance: Not only was CPython 3.11
    released, which brings some optimizations that make it on average 25%
    faster (hint, hint) than CPython 3.10, but we were also introduced to
    the Scalene Profiler by Peter at his monthly meetup talk.

    And for this year's puzzle, we need all the performance we can get...


                               THE PUZZLE PIECES
                               -----------------

    What is this?! No weird hidden-in-least-significant-bits in PNG files?
    No parse-byte-strings-and-find-all-permutations funky business?! Yep!

    What you have in front of you are three files:

        README.txt: You are reading it right now, good job!

        tracer.py: A very simple pure-Python ray tracer

        scene.dat: The scene description to be rendered

    You just need to run the tracer to produce the output image. Done!
    That is... if you have a really really fast machine with many cores
    and some hours(!) to spare. Good thing a Puzzle usually comes in small
    pieces. And small pieces in turn mean that maybe it's a task that can
    be executed in parallel? (hint, hint - obviously)


                             TOO LONG, DIDN'T READ
                             ---------------------

    Your task is to let the "tracer.py" render the content of "scene.dat"
    to an image file. Check inside the file for hints on how to parallelize
    the work and maybe distribute the ray tracing tasks to different machines
    and cores and then combine the resulting pieces into the output image.

    Any approach is allowed, from sneakernet'ing cache files via USB thumb
    drives to HTTP client/server architectures or socket-based communication
    to just renting out a bunch of cloud machines? Figure something out.


                                                     -- m@thp.io, 2022-12-15




postscript (only relevant after you've solved the initial puzzle):

Bonus content: Alternative Scenes, aka "simple byte patches for 'scene.dat'".

A line "mod:", describes a modification for 'scene.dat', the line is followed
by multiple lines of "<offset> <hexbytes>" where <offset> is the decimal
offset into scene.dat and the <hexbytes> are the bytes that need to be placed
at that offset in scene.dat (you obviously have to un-hexlify the <hexbytes>
value, operate on raw bytes, "\" is a line continuation and just extends the
hex bytes string without another byte offset). Each mod is terminated by a
line containing only "---". The patched 'scene.dat' file can then be rendered
as usual. Happy patching! :)


mod: outside-in
32 0000f041945a064000000000
56 ecd96e40
100 77150ebe69cdb53dcc807cbf00000000
120 2ef87e3f0294b73d
132 10867d3ffbc64b3c0b830dbe0000000037cb1640fbab38c0f66dc0c1
164 3f5d87bd00000000cc87f13e00000000e7dac23c4da3883e7f685a3b00000080942fe \
    742f8fec8c195a2e04176d69fc00eade5c267aec841b0fadfc16128a040
---
mod: fisheye
32 0000b4420000103f
56 0000803f00000000
100 ee966f3fd0da663b005bb43e00000000
120 bafc7f3fe6d423bc000000004e5db4be5a54193cde936f3f
148 b28a33c0d21454c005c745c1
164 f2f7d43f000000002c5320bf8f148eb44ddb663bcffc7f3f5b54193c000000808db00 \
    bc205f27ec1890154c222d79fc06f8f0a42a49d7f41e0af50420d29a040
---
mod: the-mirror
100 2acb033f0fb20abe52b6583f
120 ebc87c3f30c8213e00000000f3775bbfaa93a6bd6d23023f
148 34441b41d8d6cfbf4e0bbd400000803f8219c23e1f04c333
168 1f04c3338d9c21bf1f04433496cc65bdd069d13e3eff09bd1f04c3329a214c42a22f5 \
    6c04328cfc1f2d69fc012ed4fc2e5804c405481cb41dd28a040
---
mod: bookshelf
100 db211f3f41cd8f3d70b947bf00000000000000802ff87e3f0c94b73d
132 1888483f753a64bddd7d1e3f
148 d85a37c0bd8ef2c0345648c00000803f105dea3e3d04c3b5
168 3d04c3b5e2aa133f3d0443b43742ee3c3e39d33e0112bdbc3d0443b2b305253f81711 \
    cc2b33d96c108d79fc0a27c093ee5651c42c4969141f428a040
---
