ColorCritters my first chatGPT assisted project

ColorCritters.zip (500.6 KB)

I am surprised and pleased and a little disturbed, sure, at how much help chatGPT was here. Written in Codea on my iPhone with (not by) chatGPT. I’ve tried to write evolution simulators in Codea before and couldn’t get it to track over 200 creatures without massive slowdown. Thanks to chatGPT helping me code things I could conceptualize but not implement, this now handles over 3000 organisms without substantial slowdown and can even do over 10,000 without crashing, though to be sure it’s very slow at that point. The critters are very very simple but they are randomly reproducing with each other by blending colors. This simulation stops all breeding after the population gets over 3000.

To be clear chatGPT did not write this. It was built from the ground up using chatGPT, but all it was doing was giving me pieces of code that I asked for. The first thing I did was say “write me an evolution simulation” and the thing it gave me didn’t even run. I built it up piece by piece by asking chatGPT to give me a function that did this and a function that did that. I also often had to tweak its code because, for example, it could never remember not to use math.atan2 in Codea code.

1 Like

@UberGoober - wow, 17 tabs - that will take me some time to digest. Could you give a short basic outline of how the project operates, so I can trace the thread?

Impressive.

It’s mostly simple.

  • The basic principle is that most tabs are simply a draw() function, which means that whichever tab is bottommost is the one that will run when you hit play. So to see different things drag different tabs to the bottom.

  • The Field class and the ColorCritters class are the building blocks of the simulations. The Field generates critters and its draw function moves them around.

  • Some of these things have not actually been worked out, for example there is an “Aggression” tab which is currently just a copy of one of the other tabs.

  • The tabs above OtherMain can be dragged to the bottom, to see what they do, but should not be left below OtherMain while trying to run any of the simulations. They’re simple tests of basic functions—other than the first “Main” tab, which is a first try at this whole thing.

The basic trick here is that critters randomly sample one pixel on their perimeter every draw cycle, and decide what to do based on that.

In TinyBreeders if they detect the background color they move in that direction, and if they detect any other color they have a random chance of generating a child. The child’s color is a mix of their own color and the color detected.

@UberGoober - ahhh, got it, I think ?!* I’ll follow your suggestions and see where they lead me. Thhanks again.

Wow! Nice work. How great is ChatGPT for assisting with code? Just last night I pasted some Codea code into it and it helped me find a bug

1 Like

New version has a real-life iOS slider for switching demos!

ColorCritters.zip (140.3 KB)

Thanks @jfperusse!

See it in action in the video.

Also @Bri_G I have drastically reduced the number of tabs and organized them in a way that should be pretty clear, let me know if there’s anything confusing.

I love the slider and the use of ChatGPT! :slight_smile:

1 Like

Oh, by the way: the slider is a standalone class called DemoControl.

It’s super simple, you just give it a bunch of functions, and it switches between them.

If you like the slider, it’s free to use!