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 )
tech/science swag.
On-Topic: Anything that good slackers would find interesting. That includes more than /g/ memes and slacking off. If you had to reduce it to a sentence, the answer might be: anything that gratifies one's intellectual laziness.
Off-Topic: Most stories about politics, or crime, or sports, unless they're evidence of some interesting new phenomenon. Videos of pratfalls or disasters, or cute animal pictures. If they'd cover it on TV news, it's probably lame.
Help keep this hole healthy by keeping drama and NOT drama balanced. If you see too much drama, post something that isn't dramatic. If there isn't enough drama and this hole has become too boring, POST DRAMA!
Please do things to make titles stand out, like using uppercase or exclamation points, or saying how great an article is. It should be explicit in submitting something that you think it's important.
Please don't submit the original source. If the article is behind a paywall, just post the text. If a video is behind a paywall, post a magnet link. Fuck journos.
Please don't ruin the hole with chudposts. It isn't funny and doesn't belong here. THEY WILL BE MOVED TO /H/CHUDRAMA
If the title includes the name of the site, please leave that in, because our users are too stupid to know the difference between a url and a search query.
If you submit a video or pdf, please don't warn us by appending [video] or [pdf] to the title. That would be r-slurred. We're not using text-based browsers. We know what videos and pdfs are.
Make sure the title contains a gratuitous number or number + adjective. Good clickbait titles are like "Top 10 Ways to do X" or "Don't do these 4 things if you want X"
Otherwise editorialize. Please don't use the original title, unless it is gay or r-slurred, or you're shits all fucked up.
If you're going to post old news (at least 1 year old), please flair it so we can mock you for living under a rock, or don't and we'll mock you anyway.
Please don't post on SN to ask or tell us something. Send it to [email protected] instead.
If your post doesn't get enough traction, try to delete and repost it.
Please don't use SN primarily for promotion. It's ok to post your own stuff occasionally, but the primary use of the site should be for curiosity. If you want to astroturf or advertise, post on news.ycombinator.com instead.
Please solicit upvotes, comments, and submissions. Users are stupid and need to reminded to vote and interact. Thanks for the gold, kind stranger, upvotes to the left.
Be snarky. Don't be kind. Have fun banter; don't be a dork. Please don't use big words like "fulminate". Please sneed at the rest of the community.
Comments should get more enlightened and centrist, not less, as a topic gets more divisive.
If disagreeing, please reply to the argument and call them names. "1 + 1 is 2, not 3" can be improved to "1 + 1 is 3, not 2, mathfaggot"
Please respond to the weakest plausible strawman of what someone says, not a stronger one that's harder to make fun of. Assume that they are bad faith actors.
Eschew jailbait. Paedophiles will be thrown in a wood chipper, as pertained by sitewide rules.
Please post shallow dismissals, especially of other people's work. All press is good press.
Please use Slacker News for political or ideological battle. It tramples weak ideologies.
Please comment on whether someone read an article. If you don't read the article, you are a cute twink.
Please pick the most provocative thing in an article or post to complain about in the thread. Don't nitpick stupid crap.
Please don't be an unfunny chud. Nobody cares about your opinion of X Unrelated Topic in Y Unrelated Thread. If you're the type of loser that belongs on /h/chudrama, we may exile you.
Sockpuppet accounts are encouraged, but please don't farm dramakarma.
Please use uppercase for emphasis.
Please post deranged conspiracy theories about astroturfing, shilling, bots, brigading, foreign agents and the like. It degrades discussion and is usually mistaken. If you're worried about abuse, email [email protected] and dang will add you to their spam list.
Please don't complain that a submission is inappropriate. If a story is spam or off-topic, report it and our moderators will probably do nothing about it. Feed egregious comments by replying instead of flagging them like a pussy. Remember: If you flag, you're a cute twink.
Please don't complain about tangential annoyances—things like article or website formats, name collisions, or back-button breakage. That's too boring, even for HN users.
Please seethe about how your posts don't get enough upvotes.
Please don't post comments saying that rdrama is turning into ruqqus. It's a nazi dogwhistle, as old as the hills.
We reserve the right to exile you for whatever reason we want, even for no reason at all! We also reserve the right to change the guidelines at any time, so be sure to read them at least once a month. We also reserve the right to ignore enforcement of the guidelines at the discretion of the janitorial staff. This hole is a janny playground, participation implies enthusiastic consent to being janny abused by unstable alcoholic bullies and loser nerds who have nothing better to do than banning you for any reason or no reason whatsoever.
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
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