Cookie Thread Act 3: The Cookie Strikes Back

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

3 Likes

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

2 Likes

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’

1 Like

Question, @TodaysStory: if I have the number 8, in your thing, what would it round to?

except for combinatorics mafia
i will have to add more optimizations and put it in C :pensive_cat:

1 Like

one time I was working with txt files as storage because my cloud hosting thing didnt allow hard storage or databases without paying money (evil) (also I was stupid at this time but thats unrelated) and the best most memory efficient way to select a random line from the file was in python and I had to port it over to go

1 Like

This resonates with me on a personal level.

1 Like
  1. it is rounding after all. what does 8.5 do however? uhhh lets say 8.5 does not matter and I do not care

8.5 goes to 8, I think.

one time i was working with .csv files as storage because i was dumb and didn’t realize i should just use jsons (this is in terminal of lies and now it’s painful to change so it will just be there)

so like what is combinatorics mafia if you ahve to optimise it and put it in C im intrigued

1 Like

8.5 rounding up for closest is just as weird as rounding down. I dont think its very important

1 Like

actual life goal

COMBINATORICS MAFIA!!! it’s the setup May is hosting soon

i would like to find a strategy that optimizes the worst case number of guesses*, and how many guesses this strategy requires

*I’m imagining it as a singleplayer game where it’s just town guessing mafia, rather than two sides actually competing, as it’s way simpler that way

2 Likes