Those FRICKING monkeys stole your stuff! Get it back!
(Also, remember to leave a comment if you did something interesting )
Those FRICKING monkeys stole your stuff! Get it back!
(Also, remember to leave a comment if you did something interesting )
Now playing: Cranky's Theme (DKC).mp3
Jump in the discussion.
No email address required.
Going great for me...
Jump in the discussion.
No email address required.
there's only * and + tho
Jump in the discussion.
No email address required.
yes eventually i figured that one out
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
@JollyMoon look at this shit, me being O(n) instead of sorting the whole array!
Jump in the discussion.
No email address required.
heap creation is O(n logn) tho
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Are you feeling okay bud?
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Did anyone get it to loop through state space correctly? I tried for a few hours but couldn't get it
Jump in the discussion.
No email address required.
More options
Context
Not that bad today. Took me an embarrassingly long time to realize I needed to reduce worry levels on part 2 though
Jump in the discussion.
No email address required.
More options
Context
That second half took me longer than I would've liked... I understood the problem but I was trying to do crazy stuff with prime factors which were way off-track. Also hard-coded the inputs because fuck that noise.
Jump in the discussion.
No email address required.
More options
Context
The puzzle in Part 2 was a homework problem when I was in college. Not with the monkeys, just the part where you need to use a ring with the product of prime numbers as a modulus to determine divisibility.
Unfortunately college was more than 20 years ago so it took me a long fricking time to remember that.
Jump in the discussion.
No email address required.
Yeah, fricked up part b. Even though I was quick in trying modulo but i have embarrassingly added all the divisors instead of multiplying them. It took me 30 min for finding that out
Jump in the discussion.
No email address required.
More options
Context
More options
Context
the above has two main sources of bloat: writing out the parser instead of just doing 'eval("old => " + op)' bc eval BAD and actually parsing with a big regex instead of just a.split('\n')[3].slice(5) or whatever
why do they need to create retarded narratives? it's just a 'throwing numbers around in a datastructure problem' that has nothing to do with monkeys. they've all been very boring so far, hopefully it'll get better.
Jump in the discussion.
No email address required.
This is just a dumb brute force solution that's been written out in the most boring way possible. It's not even close to the best solution and it's just a waste of time.
Jump in the discussion.
No email address required.
hey @bbbb what's the big(O) of @ejrqiowae89q8h9 's solution?
Jump in the discussion.
No email address required.
Hey you, what's the big deal with your solution? It's O(1), which is obviously not as good as my solution.
Jump in the discussion.
No email address required.
darn @bbbb has got solutions faster than O(1)?!
Jump in the discussion.
No email address required.
Yeah, well I'm not fricking O(1), so get used to it.
Jump in the discussion.
No email address required.
who r u fricking @bbbb?
Jump in the discussion.
No email address required.
I'm fricking you, you fricking idiot.
Jump in the discussion.
No email address required.
darn really? shit i almost forgot. don't worry, i'll hit u back later @bbbb
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
That was a mistake. You're about to find out the hard way why.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Got stuck on part 2 because of big numbers and had to get help
Added
gcd
after getting helpJump in the discussion.
No email address required.
More options
Context
Jump in the discussion.
No email address required.
More options
Context
Yes i needed to include an external library to split a string in c++ and no dont ask me why i decided to make things into pointers or i have struct that only stores one value.
Also at first i assume that all throws needed to happen at the same time. So if Monkey 1 throws to Monkey 3, Monkey 3 will not throw that item in the same round again. This was not the case, and Monkey 3 would immediately keep throwing it further in the next throw.
Jump in the discussion.
No email address required.
lmao I just used
std::regex
(yeah I know) another way would be to usesize_t pos; std::stoull(line.substr(18, &pos))
and then recallsubstr
andstoull
from positionpos + 1
until you're left with an empty substringhttps://en.cppreference.com/w/cpp/string/basic_string/stoul
Jump in the discussion.
No email address required.
More options
Context
Actually found a way to optimize this. erase on a vector is slow because it had to rearrange the entire vector, but since we know that a monkey will throw all items, the vector will be empty at the end and we can just reset it with clear.
With that optimization 70% of the cpu time is spent on doing modulo operations
Jump in the discussion.
No email address required.
More options
Context
Wow, you must be a JP fan.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
me vs snakes vs @everyone
logarithmic scales, each point is the average of three measurements, figures in milliseconds
C++chads simply cannot stop winning @drama_enthusiast discuss
Jump in the discussion.
No email address required.
aight fruitcake, ready for your
plot these assemblyscript stats:
here's the calling ts code:
and the compiled code's actually portable too, u can run it in a web browser.
god i miss closures tho ... not that u'd know what those r ...
Jump in the discussion.
No email address required.
taking double digit millisecond for 10.000 throws
Those are average over 3 runs
Jump in the discussion.
No email address required.
if i hardcode the LCM mod number, it is even faster, the compiler then can actually try to optimize it.
here is the final code if anyone cares: https://pastebin.com/hxuNpb0v
Jump in the discussion.
No email address required.
couldn't make it that much faster. tried my own push/pop with static arrays, inlined lcd, inlined all my functions, removed error case branching, swapping forEach for whiles, and got the 1M time down to ~700ms.
almost within spitting distance, but i might be running up against a vm tax here.
you running on anything fancy?
Jump in the discussion.
No email address required.
no just an old ryzen 5 2600, that boost to like 3.9GHz
Is there a profiler for this kind of code? The visual studio profiler helped a lot in finding the exact lines of codes that take a while to run.
Jump in the discussion.
No email address required.
probably. there are both rust and cpp front ends to wasm, and both have profilers ... but i choose assemblyscript cause i'm a filthy web app programmer, and i dunno about anything easy to plug and play with that. since when do web programmers care about optimization?
but alas ... today's a work day, i have too much non-programming bs to deal with for fun stuff like micro-optimizing code. who gives a shit about that when ur at a multibillion dollar company?
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
huh, hardcoding lcd didn't seem to affect my runtime.
but i'm pretty tired maybe i'll take another look at it when it get up.
did i mention my code is actually portable?
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
cpu? I ran my benchmark on a 5800X with
conservative
as frequency governor. Also I'm benchmarking the whole process' time, not onlyconsole.log((Date.now() - start));
kinda unfairJump in the discussion.
No email address required.
lol, ok there snowflake. i ran the calling code as js instead of ts and timed the process with the shell time built in.
my 1mil count stats are between 890-910ms. not a big diff. if u want to go add 50ms to all the stats, that's fine. maybe i could find a way to run the wasm directly, and shave that, but i care not.
Jump in the discussion.
No email address required.
More options
Context
apple m1 max, just stock. not plugged in, but that prolly didn't matter.
this is using release build, so max compiler optimizations i think. idk, i never used assemblyscript or webassembly before this ... i just installed and darn i'm impressed.
data structure awareness helps. going from a shift() to pop() on my item processing saw 30% reduction in my 1mil count runtime.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
All them words won't bring your pa back.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Nice work king but,
replace std::list with a higher performance datastructure
Replace obsolete types for example: long long vs int64_t
split that biggest line and make it more readable
use avx-512 instructions to further humilate the competition
Jump in the discussion.
No email address required.
More options
Context
More options
Context
i forgot that i was mutating the input for part 2 and was wondering where i was fucking up for a good hour and change. i also shamelessly stole the
old = monkey[0] % maximum
because 4096+ digit ints dont really chooch u_uJump in the discussion.
No email address required.
More options
Context
IT DOESN'T WORK FOR PART B
ANY IDEA WHYYYYY
I AM GOING INSANE AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SNAKES DISCUSS
k it wasn't that difficult I just had to re-think about discrete math n shit
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Yeah I just used amd64's 1024bits register extensions
Jump in the discussion.
No email address required.
mathcels seething rn
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
I knew it! All I need were 2048bits registers!
Jump in the discussion.
No email address required.
More options
Context
More options
Context
hey bro one of your comments say "Money ID" instead of "Monkey ID" please fix kthx
Hint :check overflows
Jump in the discussion.
No email address required.
zoz
Jump in the discussion.
No email address required.
zle
Jump in the discussion.
No email address required.
zozzle
Jump in the discussion.
No email address required.
my first time getting zozzed
Jump in the discussion.
No email address required.
sentient
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
Tidied up version. Not all that different from my live solve, aside from switching to
eval
for the Monkey Operations because it's funnier to use eval, despite it being noticeably slower.Jump in the discussion.
No email address required.
you can take out the eval to make it faster, because here it will call it everytime you call the lambda function instead of only doing the eval once for each function
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Jump in the discussion.
No email address required.
More options
Context
Sorry I haven't been able to keep up with it for the past three days. I have been sleeping a lot from the semester ending and stuff. Will probably catch up later
Jump in the discussion.
No email address required.
More options
Context
butt : washed
did most of the obvious optimizations (thanks profiler) so it's down to 3.5 seconds of runtime
No, I will not use something other than a bajillion cell arrays
Jump in the discussion.
No email address required.
wat? my js runs in < 0.7.s for the full 10,000 cycles, and that's just how i wrote it ... wtf r u doing even?
Jump in the discussion.
No email address required.
It's probably just matlab jank, and maybe a poor choice of data structure since I'm not sure what are the fastest ones to use.
I'm not a programmer, just a scripter (for physics) so I just keep using high level languages (Matlab, python and some embedded C) because I don't want to bother with low level shit when I don't need it.
Jump in the discussion.
No email address required.
yeah low shit sucks, but js is about as far from low level as u can get.
but i'm surprised u wouldn't want to be experienced in basic algorithmic runtime complexity cause if ur doing simulations, that's going to determine speed of the simulation.
Jump in the discussion.
No email address required.
I do have some experience in complexity, it's just that I can't exactly do anything when the language just mostly sucks butt in pure speed, or I don't have the specific knowledge to optimize it. We only ever got into coding either very formally with the math behind complexity and proofs, or very liberally with what's basically the bare minimum to put the language on your CV.
We have no "real" CS class so I just gradually learn what is usually the fastest shit to use when I find info on it. Like a few months back I saw that the string to int conversions were horribly slow in matlab and tried shit until I stumbled upon remnants of C with sscanf, which does the job infinitely faster, and now I can't do without it.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
anyone who wants nice data prep code... lol no
no comments removed because fuck you
Jump in the discussion.
No email address required.
My favorite part is how monkey2 represents an arbitrary monkey in a loop and not actually monkey #2.
Jump in the discussion.
No email address required.
me too
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Your pulitzer's in the mail
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
When do we break the news about the bunkey?
Jump in the discussion.
No email address required.
More options
Context
was part 2 supposed to take a while to calculate?
Jump in the discussion.
No email address required.
it does for me
Jump in the discussion.
No email address required.
did*
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Got a late start, fun problem
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
I didn't know about python's eval() function
Thankfully, hardcoding took like 2 min
Jump in the discussion.
No email address required.
Hardcoding sucks if you have bugs and want to switch between the provided example(s) and the actual problem.
Jump in the discussion.
No email address required.
More options
Context
don't worry too much, because eval mostly shouldn't be used, and it seems to be slow
idk if there's a way to do it without hardcoding but without using eval
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
oh boy its going to frick me in the butt with the parsing dildo again isn't it/?!
Jump in the discussion.
No email address required.
learn regex?
Jump in the discussion.
No email address required.
I did, but then I never used it and now I don't remember even 15% of it, just the basics. Anyway done. Thank frick for c# pattern matching
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Nice post, bro! I posted it to twitter.
Jump in the discussion.
No email address required.
More options
Context
ADVENT OF PARSING
one-off error edition
Jump in the discussion.
No email address required.
and ANOTHER one on part 2, but this time it's not supposed to bug out since it's the same code (my 'puter can run it just fine on matlab, optimizing scrubs need not apply)
on round 20 of the example, I have a 2 diff compared to his
Jump in the discussion.
No email address required.
no I'm just r-slurred it was the point of the p2
Jump in the discussion.
No email address required.
It breaks when I try running it in python without the fix. The point is that the worry number will grow too large for the computer to deal with, but all the comparisons are the same if you choose the least common multiple of the tests.
Jump in the discussion.
No email address required.
yeah that was it, it's just that matlab somehow doesn't tell me it overflows
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
More options
Context