Programming thread

  • 🔧 Chat is under maintenance.
    🧊 New server is in an office waiting on a mexican.
  • Want to keep track of this thread?
    Accounts can bookmark posts, watch threads for updates, and jump back to where you stopped reading.
    Create account
I've written a lot of parsers in x86 assembly and comments are super easy. In C it's even easier. If you are using functions that read input line by line and you know the maximum line length it's even more easy.

I usually read a bunch of bytes and parse them char by char. It's really annoying to parse multibyte sequences, though, but it means that I can parse lines of any length without adjusting the length of the input buffer, but that would also require states. Speaking of which...

IN_STRING: if in string - ignore chars that represent a comment
IN_COMMENT: ignore anything up to \n or */ if it is multiline comment.

You can make your parser a bit smarter and make him recognize that some dumbass decided to put a string with */ inside a multiline comment. This requires a stack with states or recursive parser. Stack is easier.
 
Last edited:
So I'm making a non-slop game but using AI to do the scutwork, boilerplate, and build chain. I have a homelab so I might as well, yanno, fucking use it.

For getting logic down, placeholders used, etc, it's fucking great.

However, even if I have an architecture plan, and even if I plan out using an ECS dll to make sure it runs on old machines, it still spaghetti codes to fuck. This is fine, because "just get shit done and arch when you can" is what everyone should do, and games do, except for ever fixing architecture. Except for Carmack I guess, but he's also literally an AI from the future.

In terms of speed and what I'm doing, I went from solo dev to "producer, writer, director". AIs cannot do pixel art for fuck, and I'm only marginally better in terms of placeholders. They're good enough at grabbing free sound packs for alpha demos to test mechanics just fine.

I'm presently wondering why people are going "AI IZ SLOP" when, bluntly, the problem was never the code. The problem was mechanics, feel, smoothness, art direction and sound design. This is what always set things apart, period, end of story.

Besides resentment from normies, wtf am I missing here?
 
Not sure why they thought this was a good beginner problem but whatever.
(inverted color PDF read)
1794095713487.png
I think I'm missing something. I thought this book was meant for people already wrist deep in computer science.

1794096033927.png
Is this the one you were referring to? From the tail end of chapter 1?

Posting answers to these exercises sounds fun, now that I think about it.
 
Last edited:
(inverted color PDF read)
View attachment 9828591
I think I'm missing something. I thought this book was meant for people already wrist deep in computer science.

View attachment 9828613
Is this the one you were referring to? From the tail end of chapter 1?

Posting answers to these exercises sounds fun, now that I think about it.
I admit, it's been a while since I read K&R so I forgot those segments. My bad.

Anyway, I have my solution, it works very well except it messes up the formatting of the original c file.
C:
//Have to rewrite the code here
#include <stdio.h>
#include <stdlib.h>

//probably didn't need to make these bit flags
//each state determines what to do
//overall three states that have mini states
//print, check, and skip
enum ComStates{
    //all odd numbers will print
    PRINT = 1,
    CHECKSTART = 2,
    QUOTES = 3,
    LINCOM = 4,
    BLOCKCOM = 8,
    BLOCKCHECK = 10
};

//I'd like to have a way to check if the file is a c file
//but I haven't implemented it

static void PrintNoComments(FILE *cf){
    //the state variable
    enum ComStates currentState = PRINT;
   
    int fileRead; //reads individual characters from file
    char charStack = '\0'; //holds character used for checks
   
    //now for the massive while loop
    while((fileRead = fgetc(cf)) != EOF){
        switch(currentState){
            case PRINT:
                if(fileRead == '/'){
                    charStack = fileRead;
                    currentState = CHECKSTART;
                }else if(fileRead == '"' || fileRead == '\''){
                    putchar(fileRead);
                    charStack = fileRead;
                    currentState = QUOTES;
                }else{
                    putchar(fileRead);
                }
                break;
            case CHECK:
                if(fileRead == '/'){
                    currentState = LINECOM;
                }else if(fileRead == '*'){
                    currentState = BLOCKCOM;
                }else{
                    putchar(charStack);
                    putchar(fileRead);
                    currentState = PRINT;
                }
                //have to pop the stack regardless
                charStack = '\0';
                break;
            case QUOTES:
                if(fileRead == charStack){
                    charStack = '\0';
                    currentState = PRINT;
                }
                putchar(fileRead);
                break;
            case LINECOM:
                //I think the formatting issue might be here
                if(fileRead == '\n'){
                    putchar(fileRead);
                    currentState = PRINT;
                }
                break;
            case BLOCKCOM:
                if(fileRead == '*'){
                    currentState = BLOCKCHECK;
                }
                break;
            case BLOCKCHECK:
                if(fileRead == '/'){
                    currentState = PRINT;
                }else{
                    currentState = BLOCKCOM;
                }
                break;
            default:
                break;
        }
    }
   
}

int main(void){
    //only one variable need
    FILE *testFile;
   
    //for this solution the file is hard coded into the program
    //later I will make it so the user can add as many c files as they want
    if((testFile = fopen("insertCFileHere.c", "r")) == NULL){
        fprintf(stderr, "Error file could not be found!\n");
    }
   
    //call the skip comments function
    PrintNoComments(testFile);
    fclose(testFile);
   
    return 0;
}

It isn't the most elegant, but I'm happy I got it.
 
C:
enum ComStates{
//all odd numbers will print
PRINT = 1,
CHECKSTART = 2,
QUOTES = 3,
LINCOM = 4,
BLOCKCOM = 8,
BLOCKCHECK = 10 };
I think this is broken? Am I a moron, or how did you compile this?

Furthermore

C:
    if((testFile = fopen("insertCFileHere.c", "r")) == NULL){
        fprintf(stderr, "Error file could not be found!\n");
    }
I'm pretty sure it gets stuck here?
 
Last edited:
I think this is broken? Am I a moron, or how did you compile this?
I used GCC on Debian to compile it. The problem might be the “insertCFile.c” which is a placeholder name for an actual C file. Probably something else wrong in the code I posted. I hand copied it from the debian virtual machine I used, so I might’ve missed something. I’ll check over it later.
 
I used GCC on Debian to compile it. The problem might be the “insertCFile.c”
Yeah I found that in between compile attempts. How to specify the file was not obvious, however. Pretty keyed compiler choice, I used gcc on my ubuntu server myself. What I hate are MacFags with clang and broken makefiles.
hand copied it from the debian virtual machine I used
I use like xclip or something. Fuck hand copying.
Probably something else wrong in the code I posted.
Basically I went:
compile > case name typos
compiles > does nothing
specify file name > does nothing
huh that if == null looks weird > googles
It's undefined > added return 1(but an else block also works of course)
1794103104006.png
 
Last edited:
It's worth mentioning that Ada only has line comments, because anything else is prone to error. They look like this:
Code:
X := Y + Z; -- The "+" function here can be redefined, naturally.
Common Lisp features bracketed comments, opened by #| and closed by |#, which can be nested arbitrarily, but I never use them. The semicolon opens a line comment, which is more useful, and more than good with a nice editor that has rectangle commands or other easy ways to place many at once.
So I'm making a non-slop game but using AI to do the scutwork, boilerplate, and build chain. I have a homelab so I might as well, yanno, fucking use it.
That sounds like slop to me. Here's the crux of the matter: Will this usage be noted anywhere when the game's released? It shouldn't be a problem, but it would impact the people who want to play it. Wanting to use it without admitting it betrays the problem, as anyone can tell.
For getting logic down, placeholders used, etc, it's fucking great.
I prefer using languages that don't require me to contort my mind.
This is fine, because "just get shit done and arch when you can" is what everyone should do, and games do, except for ever fixing architecture. Except for Carmack I guess, but he's also literally an AI from the future.
I'm really looking forward to having my skill attributed to a wealthy plagiarism machine if I ever get the chance to program in a professional context. Basic competence makes someone an AI now, a real one!
In terms of speed and what I'm doing, I went from solo dev to "producer, writer, director".
People who use these things cope with the idea that they'll, for whatever reason, still be necessary to guide the machine. I'm not seeing it. The end goal is the total elimination of human effort, which isn't going to happen, but that's still the stated goal, and the reason for the companies continuing to get investments.
I'm presently wondering why people are going "AI IZ SLOP" when, bluntly, the problem was never the code. The problem was mechanics, feel, smoothness, art direction and sound design. This is what always set things apart, period, end of story.
I was writing a program earlier in the year, and had a set of features, say, which I can name so: A, D, H, P, and V. I put all of these in one category, but much later during a polishing stage noticed how P there was unlike the others, and the very code implementing it reflected this. When I updated the program, I remembered that it warranted a different implementation, and the code has improved by reflecting this; now the feature is separate and can operate on features A, D, H, and V, whereas previously they were mutually exclusive options. Stories change as they're written, as do programs. A machine spewing shit everywhere robs the user—I'm not going to call the guy holding the hose a programmer or even an operator here—of this basic reflection, and the whole is worse for it.
the problem was never the code
I'm so fucking sick of this phrase. It's like an illiterate looking at poetry he wrote and arguing that "words were never the problem" but also he's going to present the work as his own.
Besides resentment from normies, wtf am I missing here?
Have fun contributing to the problem. I look forward to this forum and everywhere else on the Internet accepting anything from strangers being overrun to the point of worthlessness.
 
So I'm making a non-slop game but using AI to do the scutwork, boilerplate, and build chain. I have a homelab so I might as well, yanno, fucking use it.
You can have this idea for free: build an agent into the game. Make it customize content or something a la every mario 64 is personalized. Make it shame them for installing porn games o algo.

I'm really looking forward to having my skill attributed to a wealthy plagiarism machine if I ever get the chance to program in a professional context. Basic competence makes someone an AI now, a real one!
wealthy Plagiarism Engine, JPE. That line is fucking insane, I'm using it from now on
It's like an illiterate looking at poetry
Ok this is a bar too.
 
Last edited:
That sounds like slop to me. Here's the crux of the matter: Will this usage be noted anywhere when the game's released? It shouldn't be a problem, but it would impact the people who want to play it.

I'll be straight with you. You're being a gigantic meatball now. I do not give a shit about someone who has a mob-mentality mindset and then goes grasping and cherry picking and seething and gleaning and becomes a pain in the ass who can't be falsified and refuses to listen or confront themselves.

What value do I get in putting up with your sniveling crash-outs? Any? DOES ANYONE!? Or is this serving the Luddites? Why do I give a shit about the Luddites? Why do I give a shit about if someone copies idioms from stackoverflow or github or memorizes it or re-invents the fucking wheel!?

Is "slop" a word for "low quality" or "slop" a word for "regardless of quality, I don't like the means you used to make it"?

Who's fucking business is it if an AI wrote out a fucking build chain or laid out the boilerplate that you just copy fucking paste anyway before you tweak your timing and input windows??

Wanting to use it without admitting it betrays the problem, as anyone can tell.

"Is the creator a Democrat? Are they racist?!" Fucking Christ dude. This is little different from the crash-outs the greybeards had over Java and Python, and even then Linus called out people with compilers who don't know how they work when he was doing assembly?

Can you do assembly?

I prefer using languages that don't require me to contort my mind.

And now we see the sperg reveal himself: I am an autistic elitist, I care about toil more than output, and I resent people who actually go do useful things. You're the pure mathematician shitting on the engineer. Honest to fucking god fuck off with this shit.

Nobody cares if the language is tricky to use or not.
Nobody cares how much toil was involved in setting timing windows and coefficients and exponents for acceleration curves for their games. Nobody cares about toil for their spreadsheets, their email, or their browser.
Nobody really cares how things are made.

People care if it looks good.
People care if it feels good.
People care if it works.
People care if it's buggy.
People care if it's snappy.

Nobody fucking cares how autistic you were about your code golf.

I'm really looking forward to having my skill attributed to a wealthy plagiarism machine if I ever get the chance to program in a professional context. Basic competence makes someone an AI now, a real one!

"It's OK to copy from github or stackoverflow, but god dammit, if shit is so predictable linear algebra can decompose it, that's over the line!"

Newsflash, people with programming jobs in a professional context are using it. Also, the Indians with the same tools make shit code. It's kinda funny.

Also no competence doesn't make people an AI. Did you mean to say "basic competence and AI makes someone a programmer now, a real one!"?

Is that because you're an elitist meatball who has nothing to offer but your toil mentality instead of useful programs?!

:story:

People who use these things cope with the idea that they'll, for whatever reason, still be necessary to guide the machine. I'm not seeing it. The end goal is the total elimination of human effort, which isn't going to happen, but that's still the stated goal, and the reason for the companies continuing to get investments.

OK so we whip-lashed to "AI is replacing me so I am going to cry about it."

Alright, let's assume that a computer now programs itself. Who tells it what to do? What makes it useful, or fun, or secure? Does the computer magically know how to make a game of any kind, nevermind one with a particular message? Applications and utilities?

It doesn't?

You're an Autist who wants to have your little fief hand rolling loops and doing cute trickery with types or endless CAR CDR CDR FGT shit?

There is a reason you're a code monkey and not a manager or a director and he's in the bathroom over your sink and I doubt you'll get through to him.

I was writing a program earlier in the year, and had a set of features, say, which I can name so: A, D, H, P, and V. I put all of these in one category, but much later during a polishing stage noticed how P there was unlike the others, and the very code implementing it reflected this. When I updated the program, I remembered that it warranted a different implementation, and the code has improved by reflecting this; now the feature is separate and can operate on features A, D, H, and V, whereas previously they were mutually exclusive options. Stories change as they're written, as do programs. A machine spewing shit everywhere robs the user—I'm not going to call the guy holding the hose a programmer or even an operator here—of this basic reflection, and the whole is worse for it.

"I don't know how to review code unless I wrote it myself."

"I'm the elitist better than you."

Pick one brosef.

I'm so fucking sick of this phrase. It's like an illiterate looking at poetry he wrote and arguing that "words were never the problem" but also he's going to present the work as his own.

How many fucking games have literally shit-tastic code but are fun you goddamn autistic meatball!?

Carmack didn't make Doom fun, he made an engine that could run on shitty computers.

God dammit you fucking autistic meatball.

Have fun contributing to the problem. I look forward to this forum and everywhere else on the Internet accepting anything from strangers being overrun to the point of worthlessness.

I'm commissioning art because I'm not able to somehow be a musician and a visual artist within the next year, but I want to actually get something out for the sake of making something for others instead of toiling for myself.

Your Luddism and toil-worship is apparent and I cannot help but wonder if you can ever concede any of your shit or even admit what would hypothetically falsify any of your bullshit.

What you're really arguing for is mob-mentality bullshit that shits on people who don't have a budget or a time preference. Also, apparently for obscure programming languages, since being a meatball on S.O. ended because literal AIs are less autistic than the former user base.

I'm arguing for actual output that actually fucking does things.
 
actually fucking does things.
The IQ gap between you and @UERISIMILITUDO is striking. Just from these two or so posts, it's obvious that you're a simpler person. I don't know, his posts just feel like a juicy book instead of a heckin reddit. :story:
Oh it's because you reddit space.

I'm in the middle of you two, I think LLMs and VLMs will be fun after the hype slows down and Sam Altman gives Dorio AIDs and they both die.
On that, oh for example: I've been wanting a VLM image sorter of my own. Wouldn't that be useful?

Look if I want bad code, I'll write it myself. I am not outsourcing my shit coding to a machine! Fuck you mean I shouldn't use dynamic arrays in C? It's my program! I'll write it as badly as I want!
lmfao, I like you

Can you do assembly?
This actually reminds me of a question I had. Compilers process tokens, LLMs process tokens, will one win over the other? I've seen the railing ruby guy talk about vibe coding rust, why not just vibe code assembly and take the compiler out of the equation entirely?

It seems similar to AI "artists" perhaps pointing out the use of samples and DAW instruments by real artists. It is the case that traditional musicians and animators viewed early digital artistry as soulless, but I don't think these are equivalent. Thobeit, there can be a parallel in motivation: cost.

"I don't know how to review code unless I wrote it myself."
Ngl this is a reading comprehension issue maybe? Number 1: I don't think he was saying he can't review and change code he didn't write and 2: you are not reviewing all of the code an LLM generates, you're just not. This is a nothing statement from an offended exceptional individual.
 
Last edited:
Look if I want bad code, I'll write it myself. I am not outsourcing my shit coding to a machine! Fuck you mean I shouldn't use dynamic arrays in C? It's my program! I'll write it as badly as I want!
 
why not just vibe code assembly and take the compiler out of the equation entirely?
Someone did that and let Claude write an X11 server, window manager, terminal emulator and shell all in x86 assembly without dependencies.
A small Linux desktop suite written entirely in x86_64 assembly. No libc. No toolkit. No dynamic linking. Zero runtime.
It's probably usable but disappointing (just like most fully vibe-coded software).
 
Where does wealthy plagiarism engine find all the knowledge about assembly? There is not much of assembly code online.

I wouldn't trust vibe coded assembly. Bugs are especially juicy and mean in assembly, now imagine assembly written by digital monkey. This shit is scary.

Also, I doubt that it serves any purpose really. Does this assembly code work faster or does it take less space? Unlikely. Compilers are at least predictable - same input produces the same output, which can't be said about JPEs.

One problem that JPEs have is that they forget things. With assembly there is much more context and much more things to forget.
 
Last edited:
Back
Top Bottom