Programming thread

The left one is the infamous Quake 3 Arena code for the inverse square root. Even with the comments it's not much better, and stands as a great example of why doing clever things might be 'cool' and efficient but should always be documented properly.
View attachment 3987453

The floating point trickery behind the fast inverse square root function is, in my opinion, the coolest code optimization of the last 30 years.
 
The floating point trickery behind the fast inverse square root function is, in my opinion, the coolest code optimization of the last 30 years.
It's over 30 years old and Carmack has been up front he didn't come up with it. If you trace it back to its roots it's so great because the guy who came up with it is the main guy behind the IEEE 754 floating point standard and it's taking advantage of how IEEE 754 floats work.
 
You should decompile Terraria if you want to see the longest fucking nested if/else statement in existence.

e: oh it's up on github

gaze into the abyss of right brackets and despair
I assume much of this is just switch statements that don't get decompiled the way they were written, but are they seriously including all of their data in the code? Thousands of items like:

Code:
            if (this.type == 168)
            {
                this.useStyle = 5;
                this.name = "Grenade";
                this.shootSpeed = 5.5f;
                this.shoot = 30;
                this.width = 20;
                this.height = 20;
                this.maxStack = 99;
                this.consumable = true;
                this.useSound = 1;
                this.useAnimation = 45;
                this.useTime = 45;
                this.noUseGraphic = true;
                this.noMelee = true;
                this.value = 75;
                this.damage = 60;
                this.knockBack = 8f;
                this.toolTip = "A small explosion that will not destroy tiles";
                this.ranged = true;
                goto IL_2B846;
            }

Good Lord.
Is there any legitimate explanation for this that I'm missing, could this also be some quirk of decompilation?
 
Is there any legitimate explanation for this that I'm missing, could this also be some quirk of decompilation?
I could see decompiled code looking like this if it was C++ using template metaprogramming. In fact the gigantic fucking switch statements for the translation look exactly like that's what was done.

But...it's C# and that's scary. Also the whole game is like 20 god classes and I don't think a decompiler would mess that up so I'm just gonna go with Occam's Razor here and say the actual code must be a nightmare.
 
I assume much of this is just switch statements that don't get decompiled the way they were written, but are they seriously including all of their data in the code? Thousands of items like:

Code:
            if (this.type == 168)
            {
                this.useStyle = 5;
                this.name = "Grenade";
                this.shootSpeed = 5.5f;
                this.shoot = 30;
                this.width = 20;
                this.height = 20;
                this.maxStack = 99;
                this.consumable = true;
                this.useSound = 1;
                this.useAnimation = 45;
                this.useTime = 45;
                this.noUseGraphic = true;
                this.noMelee = true;
                this.value = 75;
                this.damage = 60;
                this.knockBack = 8f;
                this.toolTip = "A small explosion that will not destroy tiles";
                this.ranged = true;
                goto IL_2B846;
            }

Good Lord.
Is there any legitimate explanation for this that I'm missing, could this also be some quirk of decompilation?
In this case, proper OOP approach would be to define a class hierarchy of items that breaks down into more and more specific item types. So for example, you'd have a Item->Equipment->UsableItem->Projectile->Thrown->Grenade. And then you could just check which class a specific item belongs to instead of using these opaque item ids. You could also assign things higher up the chain - equipment in Terraria can have mutators/enchantments and so you could link a specific mutator static class to a field on Equipment and call its 'mutate()' function on the instantiated item in order to modify its values/behaviors.

There's like a shitzillion better ways of doing this than using giant if statements.
 
Can you learn AWS on your own (without online courses) or what are some good AWS courses?

You definitely can learn AWS (or any of the large cloud vendors) on your own. I think Azure specifically has course-type setups on their documentation site that walk you through basic and medium deployments. Most of the courses on paid learning sites are usually just instructors providing the cliff notes version of the documentation for each service with the added benefit of having a sandbox environment where you can try things out. The higher up you go into the certification levels the more into the weeds you go into for each service but ultimately the documentation is always the word of god. if you have a sandbox account available (you can try out a good few through free-tier or trials) you can readily pick up the basics pretty rapidly just going through the documentation.

I've also found videos for specific services on YouTube if I ever had doubts about them. That being said the one caveat here is that videos can become outdated pretty quickly as AWS/Azure do change/release a lot of services every year. I don't have a single channel I go back to consistently but I keep the upload date in mind when looking for videos as things do change a lot.
 
  • Like
Reactions: Gender: Xenomorph
Where's all the doomposting about ChatGPT? It seems like every programming discussion the past week has been about the coming obsolescence of developers.
I don't see this happening at all. The code ChatGPT generates is horrendous outside of extremely simple and cherrypicked cases. Most of the time it looks superficially correct but has errors all over the place once you actually bother to check. Even if you could generate correct non-trivial code occasionally, you'd still have to actually verify the entire output, and that shit is so expensive that proper development from the get-go is probably cheaper at that point because you won't have to work yourself into a foreign codebase first (and work around it afterwards).

The situation reminds me a lot of the AI Dungeon hype a while ago. Look, it's modeling an entire fantasy world! Except that it does no such thing; you are the one that models, based on a bunch of generated text. Once you refuse to accept the marketing premise that is basically begging the question ("the AI creates new fantastical worlds", "the AI can understand programming concepts", ...) and stop unwittingly giving it softball prompts as a result ("I enter the cave and accept whatever fever dream awaits me there", "reproduce this function that has been written a million times under slightly different names or could be automated away by better tooling anyway", ...), the illusion falls apart real fast.
 
Where's all the doomposting about ChatGPT? It seems like every programming discussion the past week has been about the coming obsolescence of developers.
I imagine some of the most recent attention comes from the Advent of Code that started the other day. Some of the people playing this year wondered if you could copy-paste the problem description for each day into the ChatGPT prompt and have it generate a solver for you (or give you a solution outright). And as it turns out, yes you can! A noticeable amount of the leaderboard this year consists of AI-generated solvers, and the AoC jannies are now busy trying to figure out if handballing the problem to ChatGPT (or GitHub copilot) to solve it in a matter of seconds counts as "cheating" or not.

I'm with @306h4Ge5eJUJ though. Sure, the ChatGPT solvers for AoC look impressive, for instance, until you consider that AoC itself is mostly just the same puzzles year after year, with hundreds of examples of solution code posted for each puzzle by redditors showing off. Which is to say: these aren't novel problems that it's solving, and it has a ton of examples of working code it can look at. Of course ChatGPT is going to perform relatively well in those conditions.
 
Which is to say: these aren't novel problems that it's solving, and it has a ton of examples of working code it can look at. Of course ChatGPT is going to perform relatively well in those conditions.
And really, when you get down to brass tacks, we already have a machine that can search for code on Stack Overflow to do something, and patch it into your program. It's called a "pajeet" and you probably have a great many of them in production already.
 
And really, when you get down to brass tacks, we already have a machine that can search for code on Stack Overflow to do something, and patch it into your program. It's called a "pajeet" and you probably have a great many of them in production already.

Good morning sirs! So you are saying that ChatGPT is able to do the needful?
 
Anyone tried Rust? Looks interesting, you can see the good stuff they took from other languages. Steep learning curve for sure.
I deliberately have not. The language looks cool and usable enough, but the community of people that use Rust have put me off taking the dive. Half of them are actual trannies, and the other half are cultists that rewrite software in Rust just because they can, and preach the Good Word of their computer coding language with a religious zeal that makes the Lispers and Haskellites blush. Becoming a 'Rust programmer' means that these people are now your peers.
Screenshot 2022-12-08 at 15-05-23 Mara Bos on Twitter.pngScreenshot 2022-12-08 at 14-59-35 wiggler “cleancore era” on Twitter.png
 
I deliberately have not. The language looks cool and usable enough, but the community of people that use Rust have put me off taking the dive. Half of them are actual trannies, and the other half are cultists that rewrite software in Rust just because they can, and preach the Good Word of their computer coding language with a religious zeal that makes the Lispers and Haskellites blush. Becoming a 'Rust programmer' means that these people are now your peers.
View attachment 4029429View attachment 4029393
thx,Maybe Golang or OCaml then!
Can't they just design their own Queer language???
 
I deliberately have not. The language looks cool and usable enough, but the community of people that use Rust have put me off taking the dive. Half of them are actual trannies, and the other half are cultists that rewrite software in Rust just because they can, and preach the Good Word of their computer coding language with a religious zeal that makes the Lispers and Haskellites blush. Becoming a 'Rust programmer' means that these people are now your peers.
View attachment 4029429View attachment 4029393
I use it and can agree with the tranny part. I was on their discord the other day and they were talking about sending eachother testosterone blockers. It was really off putting. I might start looking for work in a different language because I can't stand the people who use this language on a whole. It is a real cool language that can do a lot of cool things. The enums and traits are super cool. But god damn the trannies.
 
thx,Maybe Golang or OCaml then!
Can't they just design their own Queer language???
It is a shame, since as you said there's a lot of cool stuff in the language. But for right now*, unless you're using it purely for your own enjoyment/projects that you don't need the input of others for, I'd avoid Rust. For now, the community is made up almost entirely of freaks, which means that often it'll be the freaks that are your peers in any open-source endeavors, and/or your coworkers if you're using Rust professionally and you're not the sole programmer.

(*I'm optimistic though: there's a 41% chance year over year that things improve. Rust is very impressive technologically and seems to have some serious staying power. So we probably just have to wait out the trannies, which isn't so insurmountable of a goal.)
 
Question for fellow Kiwis. Who are the people most responsible for the development of Rust? Does it look like it'll keep improving in the long term? Is it possible for trannies to not fuck up code while high on synthetic hormones or are they just relegated to documentation writing and PR?
 
Question for fellow Kiwis. Who are the people most responsible for the development of Rust? Does it look like it'll keep improving in the long term? Is it possible for trannies to not fuck up code while high on synthetic hormones or are they just relegated to documentation writing and PR?
I don't trust any programming language not backed by corporate money. Programming attracts all kinds of freaks with various motivations, but moneyed programming languages seek security and stability. Businesses need both to thrive and so do programming languages.

The tranny developer community completely turns me off of the project. Beyond the appalling lack of professionalism, i do not trust for one second that rust is free of zero day exploits.
Maybe i am biased, but i trust corporate greed over mental illness.
 
You should decompile Terraria if you want to see the longest fucking nested if/else statement in existence.

e: oh it's up on github

gaze into the abyss of right brackets and despair
I hope the nonexistent names are due to decompilation but jesus fucking christ.
I deliberately have not. The language looks cool and usable enough, but the community of people that use Rust have put me off taking the dive. Half of them are actual trannies, and the other half are cultists that rewrite software in Rust just because they can, and preach the Good Word of their computer coding language with a religious zeal that makes the Lispers and Haskellites blush. Becoming a 'Rust programmer' means that these people are now your peers.
View attachment 4029429View attachment 4029393
It sounds like the dev language of the anti christ. If you somehow put it on TempleOS you'd probably trigger Armageddon.
 
Back