Cookie Thread Act 3: The Cookie Strikes Back

You suck though

:heart_decoration:

1 Like

we love the demon blade

1 Like

HELP ME

1 Like

Whenever I’m ordering coffee the sentence goes through my mind and makes me almost slip up. Every time. I don’t know where I got “uhhh can I get a small hot iced” from but it exists in my head and won’t leave

5 Likes

gonna go to my local starbucks and asked for a small hot iced brb

2 Likes

Ok, I think I have something.

public int wrongRound(double number) {
  int rounded = (int) number;
  if (number == rounded) return rounded;
  return (int) (2 * rounded - number + 1.5);
}
1 Like

This took far too much Desmos chicanery to figure out.

public int wrongRound(double number) {
  int rounded = (int) number;
  if (number == rounded) return rounded;
  return (int) (2 * rounded - number + 1.5);
}
func round(x) returns x
    y = truncate(x)
    x = truncate(y + 1.5 - (x-y))

we came to similar conclusions :P

1 Like

i didnt do the error checking so it doesnt handle whole numbers properly. I wonder if theres a way. to have it check whole numbers. without a conditional

The issue I ran into is that the formula rounds the number up.

yeah it does. which makes sense. its wrong but it makes sense

1 Like

6 Likes

if anyones wondering my actual solution to this was to detect based on the velocity of the player, which is safer in the first place as it means if the player somehow goes faster than 4 pixels per tick it doesnt fail, and would work for the full 8

2 Likes

Gonna try some chicanery.

public int wrongRound(double number) {
  int rounded = (int) number;
  return (int) (2 * rounded - number + 1.5 - 1.0 / Integer.MAX_VALUE);
}

what is he cooking

Nope, Java does not like that.

the issue there is 8 being turned into 7.99999999 would like. make it round down no? we have entered a mystical realm where I no longer understand the math taking place

That’s the intention.

to make 8 round down to 7?

oh but the rounded number is the same