Follow

so what is this:

got ranges A and B
upper = clamp(B.upper, A);
offset = upper - B.upper;
lower = clamp(B.lower + offset, A);
return {lower, upper};

it starts as your usual range clamping:

upper = clamp(B.upper, A);
lower = clamp(B.lower, A);
return {lower,upper};

or you might call it an intersection, but then you have the offset calculated from upper clamping and applied to lower before clamping it, so we're pulling the range B into the A when it's to the right of it. Could do the same with lower and pull it in if it's to the left.

what do you call abomination? clampull_upper? or maybe just pull_upper...

pull_upper is classy, nothing to be ashamed of, while clampull properly telegraphs "steer clear of this madness"

this is why I can't get anything done isn't it

now if you have been programming for a while you might have noticed that comparison is just a special case of subtraction. We have a subtraction here and clamp has got to have a comparison with sameish parameters in it, so lets expand it and see if we can notice any patterns:

upper =
B.upper < A.lower ? A.lower :
A.upper < B.upper ? A.upper :
B.upper;
offset = upper - B.upper;
lower = clamp(B.lower + offset, A);
return {lower, upper};

We have 3 cases, let's consider what upper and hence offset would be in each

B.upper < A.lower ? A.lower
offset = A.lower - B.upper
A.upper < B.upper ? A.upper
offset = A.upper - B.upper
otherwise B.upper
offset = B.upper - B.upper

the parameters of comparison and subtraction are the same, and in the last case subtraction is unnecessary, it's just 0, so we can do the subtractions upfront and then compare the results

offset_lower = A.lower - B.upper;
offset_upper = A.upper - B.upper;
offset =
offset_lower > 0 ? offset_lower :
offset_upper < 0 ? offset_upper :
0;
upper = B.upper + offset;
lower = B.lower + offset;
lower = clamp(lower, A);
return {lower, upper};

ok, does it look like something now?
no, what a waste of time and effort

@namark Oh don't worry. I don't pull up anything and still get nothing done.

@trinsec you just play proprietary videogames all day >:\

@trinsec not me, I've recently had my fill of shattered pixel dungeon, it was delicious, and ima about to open a feature request issue to enable an awesome synergy for one of the player characters, now who should be jealous?

@namark Okay, then why that tone and looking unhappy? It sounded like you were jealous.

Shattered Pixel Dungeon was a fun play. Aren't there like 1000 forks off it by now?

@trinsec you tell me why do you have some tone stuck in your head? I can't tone in text... the smiley is judging you harshly however.

I wouldn't know about forks I just discovered it, and it's a fork itself.

@namark Well, I can't help if you're tone-deaf in text, just like you can't help if I'm RL-deaf.

Anyway, why the judgment? In case you were wondering, no, I can't read minds.

@trinsec that you can't get anything done cause you play videogames all day? That was like the subject matter, wasn't it? Them being proprietary add an additional angry stallman to your sentence :stallman:

@namark Mm, no. I actually slept most of today because of a gigantic migraine. I was way too busy socializing yesterday and my body is still recovering. I wish I could play lots of videogames today.

When I first commented on your toot I didn't even mention videogames, that is what you make of it.

I also do not see the point whether games are proprietary or not. If you're interested, a large chunk of my gaming time today was spent on Simon Tatham's Puzzles on my phone.

@trinsec where was your "I don't play videogames all day" objection few toots ago? You accepted my premise and built up narrative and now you're backing down.

Proprietary software is snake oil, if it was simple guilty pleasure self harm kinda thing I would give it a pass, but you're also doing free advertising for em, so the angry stallman verdict stands.

@namark
What a funny way of thinking. Sure, be an angry Stallman all you want. It bothers you, not me. What bothered me was the migraine. That's largely resolved now. Means I can take a nice long walk this afternoon. :)

And more than 80% of proprietary games I play are indies. Are you robbing them of their chance to make games now? May I not talk about games they produced?

You are really a strange person. Maybe you might want to curb your idealism a bit, since the world doesn't work that way.

@trinsec not sure what you mean by indie, independent? small? Sounds like a meaningless buzzword. Anyway it doesn't matter, what matters is what they are doing and what they are aspiring for. They are selling snake oil and they are aspiring to establish an international monopoly on their own brand of snake oil. They support and justify the existing industry and culture of exploitation, they bank on false advertising and ignorance, instead of going against it and establishing an honest business. You are so deeply entrenched in the status quo, so invested in this illusion that you are telling me now that I'm trying to rob them, when it's them who are robbing people not only of their money but of their freedom.

I know how the world works, you may rob and exploit, kill and plunder and get away with it cause of various circumstances, even be praised for it, but in no circumstance you'd get to say that what you did was right. Its wrong, deal with it as you may.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.