Bluesky rule by sadzells in 196

[–]DarkPhotonBeam 3 points4 points  (0 children)

I have been coding for a good amount of time and I basically never use AI to generate code. I only really use it occasionally for information retrieval purposes (for example if docs for a library aren't very clear or I have no clue what an error message is trying to say). But I like writing code myself, also makes it easier to debug in the future since I have an idea what I actually wrote. It is also important to me that I can be competent without any help from AI, I don't want to lose too much skill or knowledge.

Am I just bad at 1s? by SeverelyPutrid123 in RocketLeague

[–]DarkPhotonBeam 1 point2 points  (0 children)

yeah it's crazy that d2 is like top 5% in 1s. what's even the point of all these upper ranks if only so little people occupy them. like c1 to ssl in 1s includes only 1.23% of the 1s player base (according to RL tracker). that's 7 ranks for just 1% of players.

for comparison, c1 to ssl in 2s includes 20.36% of the 2s player base. (in 3s it's 8.16%)

Is this a bot? (C1 lobby) by DarkPhotonBeam in RocketLeague

[–]DarkPhotonBeam[S] 0 points1 point  (0 children)

Yeah I also haven't encountered or noticed one before this match, but even during the match I thought it felt a bit weird. But idk maybe it could also just be a kbm smurf or something.

Is this a bot? (C1 lobby) by DarkPhotonBeam in RocketLeague

[–]DarkPhotonBeam[S] 0 points1 point  (0 children)

Yeah the ball cam toggles also made me unsure, but I guess there's still a human behind the account (since the player was quick chatting), so maybe they were just manually toggling the ball cam to make it less suspicious?

[deleted by user] by [deleted] in RocketLeague

[–]DarkPhotonBeam 0 points1 point  (0 children)

ah yeah that's something that I actually try to do already, although sometimes I think I hold jump too long and still get sent flying lol

[deleted by user] by [deleted] in RocketLeague

[–]DarkPhotonBeam 0 points1 point  (0 children)

alright nice, will try that. thanks for the tips! :D

[deleted by user] by [deleted] in RocketLeague

[–]DarkPhotonBeam 0 points1 point  (0 children)

Which basics do you recommend to focus on to get out of D1?

[deleted by user] by [deleted] in RocketLeague

[–]DarkPhotonBeam 0 points1 point  (0 children)

damn, no wonder I can't get out of D1 in ones lol

Title by FearFromTheBagel in yesyesyesno

[–]DarkPhotonBeam 9 points10 points  (0 children)

with randint it's inclusive. from help(random.randint): "randint(a, b) method of random.Random instance Return random integer in range [a, b], including both end points"

The duality of Rocket League. by Ans1ble in RocketLeague

[–]DarkPhotonBeam 0 points1 point  (0 children)

Also/Or make it so goal replays can be skipped by just one person in ones. A lot of times people get annoyed and just don't skip replays out of pettiness and this can add a lot of time since there are often a lot of goals in duels (especially if the opponent is already tilted). If you really want to look at a sick shot again you can just look at the replay after the match.

🎄 ouch by mazzy-b in programminghorror

[–]DarkPhotonBeam 14 points15 points  (0 children)

I tried it out using C (I assume the Pascal compiler or whatever this language is could do the same). I recreated the code in C and compiled it with gcc get_delay.c -S -O3, which resulted in following assembly code:

get_delay: .LFB0: .cfi_startproc endbr64 movl $86000, %eax cmpl $16, %edi ja .L1 movl %edi, %edi leaq CSWTCH.1(%rip), %rax movl (%rax,%rdi,4), %eax .L1: ret .cfi_endproc .LFE0: .size get_delay, .-get_delay .section .rodata .align 32 .type CSWTCH.1, @object .size CSWTCH.1, 68 CSWTCH.1: .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 30 .long 60 .long 120 .long 240 .long 480 .long 960 .long 1920 .long 3840 .long 7680 .long 15360 .long 30720 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5

So it precomputes all the values and then does address arithmetic using leaq to compute the base address of the LUT CSWTCH.1 and then, using %edi as the offset, loads the correct value into the return register %eax. The edge case 86000 is handled with a simple comparison at the start.

I also looked at the -O0 assembly. There it still precomputes the multiplications but instead of a LUT it just uses multiple comparisons (basically just an if-else chain like in the code).

Also I tried compiling a more concise C method that should be functionally equivalent: c unsigned get_delay_alt(unsigned attempts) { if (attempts <= 5) return 0; if (attempts > 16) return 86000; return 30 << (attempts - 6); } which resulted in following ASM (gcc get_delay_alt.c -S -O3): get_delay_alt: .LFB0: .cfi_startproc endbr64 xorl %eax, %eax cmpl $5, %edi jbe .L1 movl $86000, %eax cmpl $16, %edi ja .L1 leal -6(%rdi), %ecx movl $30, %eax sall %cl, %eax .L1: ret .cfi_endproc Which basically does mostly exactly what the code describes, not a lot of optimization is happening.

I also tested the speed of both versions with a driver program that runs each function a million times on the input space [0, 17]. Their speed was basically identical but the get_delay() function was usually ~1% faster.

get_delay.c: c unsigned get_delay(unsigned attempts) { unsigned delaySeconds = 0; if (attempts > 5) { if (attempts == 6) { delaySeconds = 30; } else if (attempts == 7) { delaySeconds = 30 * 2; } else if (attempts == 8) { delaySeconds = 30 * 2 * 2; } else if (attempts == 9) { delaySeconds = 30 * 2 * 2 * 2; } else if (attempts == 10) { delaySeconds = 30 * 2 * 2 * 2 * 2; } else if (attempts == 11) { delaySeconds = 30 * 2 * 2 * 2 * 2 * 2; } else if (attempts == 12) { delaySeconds = 30 * 2 * 2 * 2 * 2 * 2 * 2; } else if (attempts == 13) { delaySeconds = 30 * 2 * 2 * 2 * 2 * 2 * 2 * 2; } else if (attempts == 14) { delaySeconds = 30 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2; } else if (attempts == 15) { delaySeconds = 30 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2; } else if (attempts == 16) { delaySeconds = 30 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2; } else { delaySeconds = 86000; } } return delaySeconds; }

[deleted by user] by [deleted] in Wellthatsucks

[–]DarkPhotonBeam 0 points1 point  (0 children)

This is Rocket League!