What is Nostr?
mleku
npub1fjq…leku
2025-01-29 20:05:17

mleku on Nostr: humbug... i have sat trying to write this timeslot overlap algorithm for too many ...

humbug... i have sat trying to write this timeslot overlap algorithm for too many hours today and i can't unglue myself

i mean, i have solved the basic problem now, i have a printer for the composite schedules that shows when the overlaps open and close

gonna see to it tomorrow i guess...

the trick to solving the problem was the composite of the entry's open/close and a counter that adds and subtracts a value, and a "last value"

i know i'm doing this wrong somehow

i can see if i compare each day i can do a min/max on start/end, so, -6->4 and 2->15 the max on the left is 2 and the min on the right is 4, i've probably done this all wrong and wrote it as a state machine when it can be measured by day so long as you apply the timezone offsets

it really looks liek that... for example, second case

4->7 and 6->11 the max on the left is 6 and the min on the right is 7

and then we have some examples where you get no overlap

3->6 and 10->15 the max on the left is 10 and the min on the right is 6, because 10 is higher than 6 there is no overlap

idk why i didn't see this before but ok, now i see it, tomorrah i totally simplificate all this code because max start min end per day is far far easier to compute

i was thinking i needed to make some state machine that puts all the events into a sorted sequence and then counts the open/close transitions but this is much simpler
Author Public Key
npub1fjqqy4a93z5zsjwsfxqhc2764kvykfdyttvldkkkdera8dr78vhsmmleku