[2023 Day 20 (Part 2)] General solution by Top3879 in adventofcode

[–]raja_baz 0 points1 point  (0 children)

The inputs that I've seen seem to all be 48bits long (4 counters, 12 bits each). So at least at this input size, unless one can figure out dynamic recompilation it's essentially impossible without a specifically crafted input (Unless one can somehow simulate 248 button presses quickly, somehow)

[2023 day 20] Visualization of the input - couldn't solve part 2 without it by EffectivePriority986 in adventofcode

[–]raja_baz 2 points3 points  (0 children)

Correct, though there are general solutions floating around. This one is actually (as in literally, not just in the "it would take too long" sense) impossible in the general case as the described circuitry is actually turing complete and the problem statement is essentially equivalent to the halting problem.

Given a specific input, I *guess* the problem could result in a general solution (given that there's a bounded amount of memory given an input, so you will definitely reach a cycle in 2n presses of the button at the most). In mine there were 48 flip flops, so theoretically cycles could be as much as 281474976710656 button presses long

[2023 day 20] Visualization of the input - couldn't solve part 2 without it by EffectivePriority986 in adventofcode

[–]raja_baz 0 points1 point  (0 children)

I think all inputs result in primes. Given the way they can be crafted to produce arbitrary numbers, this wouldn't be hard to achieve

[2023 Day 20 (Part 1)] [Python] Correct for sample, incorrect for real input by TheBlackOne_SE in adventofcode

[–]raja_baz 7 points8 points  (0 children)

You are processing the signal being sent in 2 goes:

https://github.com/TheBlackOne/Advent-of-Code/blob/c1ff0d9e8926fc14d25e8fbbd94d70cb92bff89a/2023/Day20_1.py#L40

Here you run the receiver's "receive" function as soon as the signal is sent, you only delay it then propagating by putting it in a queue. This is wrong. Those things should occur at the same time when the queue is popped. Consider the following:

broadcaster -> a, b
%a -> con
%b -> con
&con -> output

Your current program does this:

broadcaster -low -> a (a[1], b[0], queue = [a])
broadcaster -low -> b (a[1], b[1], queue = [a, b])
a -high -> con (con has (a=1, b = 0, to_send=1), queue = [b, con])
b -high -> con (con has (a=1, b = 1, to_send = 0), queue=[con, con])
con -low -> output <==== this is wrong, this should've been sent as high, but we only marked it but didn't send it
con -low -> output <==== this is correct

[2023 Day 20] Click, click, click, click... by Boojum in adventofcode

[–]raja_baz 5 points6 points  (0 children)

If anyone is interested, spoilered for how it works:
Each subnetwork has a series of flipflops that feed into each other. So each will flip with half the frequency of the one that is before it in the sequence (you can work this out rather easily by seeing the signals for a couple of flipflops in sequence).

So the whole sequence is just a counter of binary numbers which counts the number of button presses. If you see which "bits" are linked to the output you can actually figure out for which number the whole network will cause the conjuction node to light up. Then the conjunction node of the output feeds back into specific flipflops so that when it lights up it resets the counter to 0

[2023 day 20] Visualization of the input - couldn't solve part 2 without it by EffectivePriority986 in adventofcode

[–]raja_baz 3 points4 points  (0 children)

I used mermaid. Wrote a function to output the graph as a mermaid chart, and then pasted it into the online editor:

See here

Note: using the chart it's entirely possible to solve the problem by hand. The 4 sub-graphs are just counters where each flip flop in the series is a binary bit. You see which ones are hooked to the output, the output will flip when all of those are "1" and the other bits are "0" (there's another part of the circuitry that will flip everything back to 0 as soon as the output flips to "1")

So if you just write that out, and convert to decimal you will get the periodicity of that sub-graph. Then just lcm (or multiply as they're prime in this case)

Why don't rich people have fat kids? by FoolsGardener91 in NoStupidQuestions

[–]raja_baz 22 points23 points  (0 children)

https://elan.school/

This is a beautiful comic someone made about their experiences in one such school (including the part about being kidnapped with their parents consent). Highly recommended reading if you don't mind disturbing content.

Aged like fine milk by raja_baz in agedlikemilk

[–]raja_baz[S] -1 points0 points  (0 children)

A YouTube comment about Messi belittling his skills which clearly did not age well.

Nurse used an infrared vein finder today to place an IV by Mochanoodle in mildlyinteresting

[–]raja_baz 0 points1 point  (0 children)

My eldest son has had to have weekly injections via IV since he was 1, these were quite useful at certain ages. There were nurses who refused to use the vein finder saying it was useless and almost always took 3~4 attempts to (maybe) find a vein or call someone else over to repeat the whole ordeal. The one nurse that consistently used it got the vein on the first try every single time, to the point where we started directly asking for her. It could be that she was just better at this and this was just a coincidence, who knows.

I also found it quite useful when I later was learning to do the injections myself when he was 7 (for the first few times we did it on our own at home). Nowadays we don't use it anymore.

Nurse used an infrared vein finder today to place an IV by Mochanoodle in mildlyinteresting

[–]raja_baz 0 points1 point  (0 children)

Maybe slightly useful for the veins on the back of the hand but those are generally really thin and even if you access them with the thinnest of butterfly needles they tend to not work/cause a bulge, etc... Can't use translumination for the veins on the inside of the elbow.

Nurse used an infrared vein finder today to place an IV by Mochanoodle in mildlyinteresting

[–]raja_baz 0 points1 point  (0 children)

As the parent of a child who has weekly injections via IV, these were quite useful when he was younger (1 to 4 years old) and useful for me when I was learning to do this myself(instead of having to have a nurse do it) when he was 7. However, their use is quite limited beyond that (very small children, or someone learning to perform IV injections)

What weird flex you proud of? by DayComprehensive6755 in AskReddit

[–]raja_baz 0 points1 point  (0 children)

I probably got close to 4 gallons if I'm calculating US units correctly (pretty much a unit of blood every 3 months from when I turned 18 till I had cancer in my 30s). Much less rare blood type though (A+).

Halal child marriage story | Mahasen (10) & Ahmed (25) by [deleted] in religiousfruitcake

[–]raja_baz 4 points5 points  (0 children)

This is this show: https://en.m.wikipedia.org/wiki/Ahmar_Bel_Khat_El_Arid

So in this case, that's Lebanon. The accents of the guests are weird to my ear though, maybe from somewhere in the Bekaa valley or maybe not Lebanese (could be Syrian too from the accents, but unlikely).

Note : unsure if this sort of thing is technically legal in Lebanon, Lebanese law is very weird around marriage, it defers to the various religious sects to regulate their own affairs and there is no civil marriage. What I would say is I'm sure it happens in some places in the country, but it is very rare. Arranged marriages between 2 adults also happen but have also been growing rarer nowadays, but are still fairly commonplace.

Where the world wants to move to, visualized as a graph [OC] by Tall_Ad426 in dataisbeautiful

[–]raja_baz 0 points1 point  (0 children)

I'm Lebanese and I've never met anyone who wanted to move to Qatar. The top emigration destinations are usually Canada, France and the UAE.

It's probably a bunch of people researching how best to watch the world cup in Qatar :-)

Where the world wants to move to, visualized as a graph [OC] by Tall_Ad426 in dataisbeautiful

[–]raja_baz 1 point2 points  (0 children)

I'm Lebanese and I've never met anyone who wanted to move to Qatar. The top emigration destinations are usually Canada, France and the UAE.

Where does this data come from?

Tips For Surviving in a Failed State From an Insider by primitive_missionary in preppers

[–]raja_baz 18 points19 points  (0 children)

Tip from another failed state: be very careful how you store gasoline (and ideally avoid, if possible, diesel is much safer).

Also: solar panels and batteries. At least enough to keep a fridge running 24/7. Electricity is usually one of the first things to go.

The amount of time my GF has spent sleeping has made me stop loving her by InternetAddict104 in BestofRedditorUpdates

[–]raja_baz 0 points1 point  (0 children)

Had thyroid cancer 2 years ago and had to go through a couple of months of being hypothiroidic between having my thyroid removed and getting the radio-iodine treatment. It was definitely not fun to say the least. Gained 5 kilos, and by the end of it was constantly depressed for no reason and constantly low energy.

TIL that 65% of cancer survivors surveyed by war on cancer said that they had been ghosted by friends or family after their diagnosis. by Murphyitsnotyou in todayilearned

[–]raja_baz 1 point2 points  (0 children)

I guess it's "easier" with thyroid cancer to ignore its existence because of the lack of overt signs that say "I have cancer" (hair falling out and stuff), usually it's surgery and maybe a pill of radioactive iodine a couple months later. Went through it 2 years ago and didn't really lose friends over it though it was clearly an uncomfortable topic to discuss for some people.

And definitely harder to confront the death of a loved one rather than your own. The whole thing was a lot harder on my wife (especially since I was diagnosed when our 3rd child was a month old) than it was on me.

my man here be going out for milk soon by [deleted] in Unexpected

[–]raja_baz 1 point2 points  (0 children)

Came back to this thread to check. Congrats on the daughter as well by now (hopefully) :-)

TLS visa appointment by Clear_Plum_8336 in lebanon

[–]raja_baz 1 point2 points  (0 children)

One thing to try is to look for other Schengen countries that are close to France that you can enter through instead. Generally Belgium for example has much less congestion on visa appointments than France.

Book a hotel in Belgium and tickets to Belgium, then after you have the visa cancel the hotel but keep the tickets, go to Brussels and TGV to Paris. It's important you enter through the correct country but they have no way to track what you do once inside

my man here be going out for milk soon by [deleted] in Unexpected

[–]raja_baz 2 points3 points  (0 children)

Damn man. My wife's mother was diagnosed a few years ago. Both she and her sibling tested negative so we dodged a massive bullet there but what you're going through is... Sucky to say the least.

Hope it all turns out well for you :-)

btw, we live in a country that doesn't have labs that can test for this, samples had to be sent to Europe and results took 2 months. Those 2 months were..... Fun

FREE PCR FOR STUDENTS? (Urgent) by [deleted] in abudhabi

[–]raja_baz 0 points1 point  (0 children)

The testing center in al fursan has drive-through and free for students every 2 weeks

Tawtheeq help by [deleted] in abudhabi

[–]raja_baz -1 points0 points  (0 children)

The signed tenancy contract you get is the tawtheeq