Just asked the new ChatGPT to write a p5js physics simulation that includes both gravity and collisions. Although I had to fix the code (mainly moving things around due to scope issues) it wrote a decent program: