News for hackers. Stuff that matters.
Re:AI Dungeon will block certain words, review content flagg... by klyrs on Wednesday April 28, 2021 @07:38PM (#26975604)
Yup, hypot is better on performance grounds, if you assume I'm using doubles. But is it as readable as my snippet?
Re:AI Dungeon will block certain words, review content flagg... by Noumenon72 on Wednesday April 28, 2021 @08:32PM (#26976000)
How could it not be? It has a name that says what it's doing, while yours is more punctuation than text. To "read" yours I have to just skim over it and mentally assign "according to the variable name, that hodgepodge means 'distance'... I hope".

I have a BS in math, so obviously I'm familiar with the math notation, but I code like an English major.

Re:AI Dungeon will block certain words, review content flagg... by klyrs on Wednesday April 28, 2021 @08:47PM (#26976133)
If the function was named "hypotenuse" then it would be unambiguously more readable. But since the function is considerably older than the modern zealotry surrounding code readability, it's this weird 5-letter word that most people aren't familiar with. Contrast that to the Pythagorean theorem, which folks are exposed to in elementary/middle school.
Re:AI Dungeon will block certain words, review content flagg... by seoaeu on Wednesday April 28, 2021 @10:56PM (#26976930)
Yeah, not to mention tons of possible variations of that line that you might not notice at a glace but would completely change the output.
Re:AI Dungeon will block certain words, review content flagg... by klyrs on Wednesday April 28, 2021 @11:12PM (#26977011)
Yeah, my bad for not radiation-hardening my code

https://github.com/mame/radiation-hardened-quine

Re:AI Dungeon will block certain words, review content flagg... by seoaeu on Thursday April 29, 2021 @11:35AM (#26982505)
I was thinking more in line with http://www.underhanded-c.org, but that was also an interesting read
Re:AI Dungeon will block certain words, review content flagg... by sdenton4 on Wednesday April 28, 2021 @08:52PM (#26976173)
Well, clearly we need a metricFactory to provide the distance function, in case we later want our game to run in a non euclidean context.
Re:AI Dungeon will block certain words, review content flagg... by klyrs on Wednesday April 28, 2021 @10:01PM (#26976637)
I hope you get that metricFactory out of a computableMathConceptFactoryFactory