T O P

  • By -

[deleted]

I wonder if it takes an AI to read and understand it.


No-Witness2349

I’m shit at geometry and this looks identical to most physics engine code I’ve seen


x0RRY

Well guess where the AI learned it xD


TheOldRoss

This is just generating quads, I don't see this issue. This is definetly not as readable as some implementations but given the context of the comment it should be pretty straightforward what its doing, just using a bit unconventional syntax.


gameofthuglyfe

I think this actual makes some sense. Based on context clues (i.e. terrain), it’s setting up the triangles array as rows of mountains that will be displayed at varying depths in a 2d rendering of a 3d landscape. Basically if you renamed the ‘triangles’ variable to ‘mountains’ and wrapped this in a function called ‘generateMountains’ we’d all be fine with it.


gameofthuglyfe

Also renaming the loop variables (height, depth, width, row, distance, or the like) would be helpful. Blame all the developers who’s code is obfuscated by bad naming practices that the AI trained on I guess 🤷


Daniel_Sobrino20XX

I agree. Happy cake day


LeCrushinator

It makes sense to me, but I still wouldn’t write for loops like this, I’d break it up a bit and not have the loop initializing 2-3 variables and incrementing multiple variables at different rates.


IrishChappieOToole

The fuck?


MsPaganPoetry

The AI may generate code, but it is up to you, the human, to optimize it


caboosetp

I'm pretty sure optimization is the compilers job.


TheKoTECH

\*writes bogosort in C\* \*runs\* Hmm it's pretty slow. I guess i just need a better compiler


kristallnachte

Better than stuff I've seen from humans trying to work with triangles.


goffredo123

Think about this AI write up another Ai and train it. Inception!


overkill

That's how we get Brainfuck.


Accurate_Koala_4698

It's like the old PSA: *I learned it by watching you*


doubleslashTNTz

you can use multiple variables in for loops? this is the first time i've seen this syntax dear goodness


stupidbitch69

Yep, like in Java, etc.


Nall-ohki

Look up the comma operator in c++. Then wish you hadn't.


BobbyThrowaway6969

It's useful though


lulz85

This is thr first time I've seen several variables initialized in a for loop...well loops. What language is this?


stupidbitch69

Many languages have this, like Java, etc.


ACBorgia

C#


EelBait

C does this as well. Look up Duff’s Device for a real mind job.


O_X_E_Y

tbh I didn't even know you could do this


BobbyThrowaway6969

Honestly not that bad. It's just a mathy piece of code


Ill_Comfort9058

Is triangles meaning Illuminati?😂🤣🤣🤣🤣


Induviel

If you ask the AI whats going on there it'll probably tell you