Re: p2
Definitely a bit tedious, I had to "play" a whole session to spot bugs that I had. It took me far longer than average. I had buggy dissepearing boxes because of update order, I would reccomend a basic test case of pushing a line/pyramid of boxes in every direction.
Updated Reasoning
Ok it probably works because it isn't bang center but a bit up of center, most other steps most be half half noise vertically, and the reason it doesn;t minimize on an earlier horizontal step (where every step is mostly half half), is because the middle points on the trunk, that don't contribute to the overall product therefore minimizing it even lower.
Day 14, got very lucky on this one, but too tired to think about why part 2 still worked.
spoiler
#!/usr/bin/env jq -n -R -f
# Board size # Our list of robots positions and speed #
[101,103] as [$W,$H] | [ inputs | [scan("-?\\d+")|tonumber] ] |
# Making the assumption that the easter egg occurs when #
# When the quandrant product is minimized #
def sig:
reduce .[] as [$x,$y] ([];
if $x < ($W/2|floor) and $y < ($H/2|floor) then
.[0] += 1
elif $x < ($W/2|floor) and $y > ($H/2|floor) then
.[1] += 1
elif $x > ($W/2|floor) and $y < ($H/2|floor) then
.[2] += 1
elif $x > ($W/2|floor) and $y > ($H/2|floor) then
.[3] += 1
end
) | .[0] * .[1] * .[2] * .[3];
# Only checking for up to W * H seconds #
# There might be more clever things to do, to first check #
# vertical and horizontal alignement separately #
reduce range($W*$H) as $s ({ b: ., bmin: ., min: sig, smin: 0};
.b |= (map(.[2:4] as $v | .[0:2] |= (
[.,[$W,$H],$v] | transpose | map(add)
| .[0] %= $W | .[1] %= $H
)))
| (.b|sig) as $sig |
if $sig < .min then
.min = $sig | .bmin = .b | .smin = $s
end | debug($s)
)
| debug(
# Contrary to original hypothesis that the easter egg #
# happens in one of the quandrants, it occurs almost bang #
# in the center, but this is still somehow the min product #
reduce .bmin[] as [$x,$y] ([range($H)| [range($W)| " "]];
.[$y][$x] = "█"
) |
.[] | add
)
| .smin + 1 # Our easter egg step
And a bonus tree:
I liked day 13, a bit easy but in the right way.
Edit:
Spoilers
Although saying "minimum" was a bit evil when all of the systems had exactly 1 solution (not necessarily in ℕ^2),
I wonder if it's puzzle trickiness, anti-LLM (and unfortunate non comp-sci souls) trickiness or if the puzzle was maybe scaled down from a version where there are more solutions.
re:followup
If you somehow wanted your whole final array it would also require over 1 Peta byte ^^, memoization definetely reccomended.
Day 11
Some hacking required to make JQ work on part 2 for this one.
Part 1, bruteforce blessedly short
#!/usr/bin/env jq -n -f
last(limit(1+25;
[inputs] | recurse(map(
if . == 0 then 1 elif (tostring | length%2 == 1) then .*2024 else
tostring | .[:length/2], .[length/2:] | tonumber
end
))
)|length)
Part 2, some assembly required, batteries not included
#!/usr/bin/env jq -n -f
reduce (inputs|[.,0]) as [$n,$d] ({}; debug({$n,$d,result}) |
def next($n;$d): # Get next # n: number, d: depth #
if $d == 75 then 1
elif $n == 0 then [1 ,($d+1)]
elif ($n|tostring|length%2) == 1 then [($n * 2024),($d+1)]
else # Two new numbers when number of digits is even #
$n|tostring| .[0:length/2], .[length/2:] | [tonumber,$d+1]
end;
# Push onto call stack #
.call = [[$n,$d,[next($n;$d)]], "break"] |
last(label $out | foreach range(1e9) as $_ (.;
# until/while will blow up recursion #
# Using last-foreach-break pattern #
if .call[0] == "break" then break $out
elif
all( # If all next calls are memoized #
.call[0][2][] as $next
| .memo["\($next)"] or ($next|type=="number"); .
)
then
.memo["\(.call[0][0:2])"] = ([ # #
.call[0][2][] as $next # Memoize result #
| .memo["\($next)"] // $next # #
] | add ) | .call = .call[1:] # Pop call stack #
else
# Push non-memoized results onto call stack #
reduce .call[0][2][] as [$n,$d] (.;
.call = [[$n,$d, [next($n;$d)]]] + .call
)
end
))
# Output final sum from items at depth 0
| .result = .result + .memo["\([$n,0])"]
) | .result
Not surprised, still very disappointed, I feel sick.
And also closing with:
Nvidia insists that it “wins on merit, as reflected in our benchmark results and value to customers.” And Nvidia does have the best stuff — but that’s not what the DOJ, Warren, or France are concerned about, is it?
To tie the bow nicely.
Quinn enters the dark and cold forest, crossing the threshold, an omnipresent sense of foreboding permeates the air, before being killed by a grue.
“Once we get AGI, we’ll turn the crank one more time—or two or three more times—and AI systems will become superhuman—vastly superhuman. They will become qualitatively smarter than you or I, much smarter, perhaps similar to how you or I are qualitatively smarter than an elementary schooler. “
Also this doesn't give enough credit to gradeschoolers. I certainly don't think I am much smarter (if at all) than when I was a kid. Don't these people remember being children? Do they think intelligence is limited to speaking fancy, and/or having the tools to solve specific problems? I'm not sure if it's me being the weird one, to me growing up is not about becoming smarter, it's more about gaining perspective, that is vital, but actual intelligence/personhood is a pre-requisite for perspective.
Hi, I'm going to be that OTHER guy:
Thank god not all dictionaries are prescriptivists and simply reflect the natural usage: Cambridge dictionary: Beg the question
On a side rant "begging the question" is a terrible name for this bias, and the very wikipedia page you've been so kind to offer provides the much more transparent "assuming the conclusion".
If you absolutely wanted to translate from the original latin/greek (petitio principii/τὸ ἐν ἀρχῇ αἰτεῖσθαι): "beginning with an ask", where ask = assumption of the premise. [Which happens to also be more transparent]
Just because we've inherited terrible translations does not mean we should seek to perpetuate them though sheer cultural inertia, and much less chastise others when using the much more natural meaning of the words "beg the question". [I have to wonder if begging here is somehow a corruption of "begin" but I can't find sources to back this up, and don't want to waste too much time looking]
I feel mildly better, thanks.
EDIT: I have a sneaking suspicion that the computer will need to be re-used since the combo-operand 7 does not occur and is "reserved".
re p2
Also did this by hand to get my precious gold star, but then actually went back and implemented it Some JQ extension required: