Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So I scanned the beginning of the generated code, picked line 83:

  animation: glow 2s ease-in-out infinite;

stuffed it verbatim into google and found a stack overflow discussion that contained this:

      animation: glow .5s infinite alternate;

in under one minute. Then I found this page of CSS effects:

https://alvarotrigo.com/blog/animated-backgrounds-css/

Another page has examples and contains:

  animation: float 15s infinite ease-in-out;

There is just too much internet to scan for an exact match or a match of larger size.


That's not an example of copying from an existing Space Invaders implementation. That's an LLM using a CSS animation pattern - one that it's seen thousands (probably millions) of times in the training data.

That's what I expect these things to do: they break down Space Invaders into the components they need to build, then mix and match thousands of different coding patterns (like "animation: glow 2s ease-in-out infinite;") to implement different aspects of that game.

You can see that in the "reasoning" trace here: https://gist.github.com/simonw/9f515c8e32fb791549aeb88304550... - "I'll use a modern design with smooth animations, particle effects, and a retro-futuristic aesthetic."


I think LLMs are adapting higher level concepts. For example, the following JavaScript code generated by GLM (https://github.com/simonw/tools/blob/9e04fd9895fae1aa9ac78b8...) is clearly inspired by this C++ code (https://github.com/portapack-mayhem/mayhem-firmware/blob/28e...), but it is not an exact copy.


This is a really good spot.

That code certainly looks similar, but I have trouble imagining how else you would implement very basic collision detection between a projectile and a player object in a game of this nature.


A human would likely have refactored the two collision checks between bullet/enemy and enemyBullet/player in the JavaScript code into its own function, perhaps something like "areRectanglesOverlapping". The C++ code only does one collision check like that, so it has not been refactored there, but as a human, I certainly would not want to write that twice.

More importantly, it is not just the collision check that is similar. Almost the entire sequence of operations is identical on a higher level:

    1. enemyBullet/player collision check
    2. same comment "// Player hit!" (this is how I found the code)
    3. remove enemy bullet from array
    4. decrement lives
    5. update lives UI
    6. (createParticle only exists in JS code)
    7. if lives are <= 0, gameOver


So, your example of it copying snippets is… using the same API with fairly different parameters in a different order?


The parent said

> find even a few lines of code duplicated from one of those projects

I'm pretty sure they meant multiple lines copied verbatim from a single project implementing space invaders, rather than individual lines copied (or likely just accidentally identical) across different unrelated projects.


Is this some kind of joke?

That's how you write css. The examples aren't the same at all, they just use the same css feature.

It feels like you aren't a coder--you've sabotaged your own point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: