this does break integers though
practical uses are boring
i love impractical math
I wonder what real life practice even exists for root square numbers?
If youâre doing Java, you can just cast it to an integer.
Oh, wait, I see what youâre doing.
You might laugh, but we used pythagoras principle, when we made the garage in our garden, so we will make sure it becomes a perfect rectangle. (Pythagoras uses square root, just for giving you an IRL example.)
Maybe then something like:
public int roundWrong(double number) {return -((int) -8.6);}
Thatâs still gives 9, doesnât it?
I suppose! But besides geometry?
I think it rounds up to -8?
that breaks numbers like 8.3 tho
Let me check.
Right.
In storyâs silly ahh goofball world of her own doing, collision detection. and like it probably isnt the best way for that either but I discovered theres absolutely nothing on this and now im just fascinated
you have the goober
she is currently fully in tile 10 or tile 3:2 of this image. tile 10 is blank. it doesnt do anything on interaction. all good. 3 rounds to 3 and 2 rounds to 2. a dummy function is called
but lets say you have a normal situation, where say, gravity is being applied. she goes down. just a teency bit.
she is now in 3.1:2. The tile being touched is 4:2. the previous tile that she is in more of doesnât matter as the gravity of the game means she will never reach a tile faster than it can be detected.
Okay, now the goober moves left. On this tick, after gravity, she is at 3.1:1.9. the two functions that need called are 4:2 and 3:1
On any given tick only 2 tiles need to be interacted with, being near round x, far round y, and far round x, near round y.
is this overly complex?? yes! yes it is! i do not need to do this! there is no harm in using conditionals or my slightly clunky solution or taking an actual course on games development instead of just winging it like a boss! however. i think this is neat
I also think itâs neat.
Yeah, I think the solution is probably just to figure out the top number and subtract from that.
So like:
public int roundWrong(double number) {
int upValue = ((int) number) + 1;
return upValue - ((int) (number + 0.5));
}
The annoying part is that this is a piecewise function, so youâre not going to get any neat solution minus potentially some sin/cos wave shenangians?
my need to unneccesarily optimise random things will persist forever. I was born in the wrong generation man. Take me back to programming restraints and people making software on their own
meanwhile me writing python code and going âit works nya nya nya it doesnât need to be fast it never runs with large inputsâ
