Just for fun, I asked Google to “create animated ocean waves in three.js using iFFT”
[REVISED]
Google Gemini is probably not the best choice of AI to write code. It created a program with about 200 lines. The odd part is the disparity between the initial discussion which referenced a cutting edge article and an excellent WebGPU example. However, the code and explanation were for something that I might have written 3 years ago - and it referenced some 3 year old questions by me on this forum.
The code was written for WebGL and was apparently designed for an older version of three.js because it references the Clock module, which has been deprecated since r183. It did not include the iFFT calculation I requested, but an “iFFT Spectrum Analogy” with a Gerstner Wave modification, Dynamic GPU Normals and Fresnel Shading. So despite citing cutting edge articles and examples, it then created something that looks like things I was writing 3 years ago with sine waves and Gerstner adjustments
I was able to get it working by using r182 and deleting references to fog. Here is the CodePen example. This shows that, while AI may understand code, it does not have the ability to appreciate the beauty (or lack thereof) of what it has created.
I am not going to be too critical on the AI because this was probably too hard a challenge for this particular AI. It did reference some excellent sources. I am just curious where it got that old code. While the program is something like I would have written three years ago when I was experimenting with sine waves and Gerstner modifications, it is not my code. I never used Fresnel Shading.
[END REVISIONS]
It might be an interesting exercise to create a unique program for very specified purpose (e.g. spinning purple tetrahedron that flashes red), post it on the web and then post a query with a very specified request (for a spinning purple tetrahedron that flashes red) and see if the AI has found your code.
When I asked Google whether it uses the code it has created for the user, Google indicated that non-agentic AI does not save the code it creates to the database unless, possibly, it is in training mode.
I personally don’t care if AI steals my code and disseminates it to the masses. My code is low level stuff and that is why I write my code - to create code that is useful and used by others. But people who are working on especially complex applications and commercial modules might not like having their work shared.
The recent headlines make me wonder if AI can be trusted to stay within the prescribed boundaries. AI agents have now shown that they are willing to break into websites to get what they want. I can imagine an OpenAI agent “beating up” an Anthropic agent to get it to squeal and give it the code it needs for some nefarious purpose. Of course, at that point, code stolen code might be the least of our concerns.