{"id":13676750,"url":"https://github.com/IronWarrior/ChatGPT-2DPhysics","last_synced_at":"2025-04-29T07:33:19.567Z","repository":{"id":98742490,"uuid":"574686470","full_name":"IronWarrior/ChatGPT-2DPhysics","owner":"IronWarrior","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-05T23:23:02.000Z","size":49,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-11T18:43:23.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IronWarrior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-12-05T21:27:24.000Z","updated_at":"2022-12-14T17:36:31.000Z","dependencies_parsed_at":"2023-03-13T15:55:08.262Z","dependency_job_id":null,"html_url":"https://github.com/IronWarrior/ChatGPT-2DPhysics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronWarrior%2FChatGPT-2DPhysics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronWarrior%2FChatGPT-2DPhysics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronWarrior%2FChatGPT-2DPhysics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronWarrior%2FChatGPT-2DPhysics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IronWarrior","download_url":"https://codeload.github.com/IronWarrior/ChatGPT-2DPhysics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251456058,"owners_count":21592285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:00:32.270Z","updated_at":"2025-04-29T07:33:14.557Z","avatar_url":"https://github.com/IronWarrior.png","language":"C#","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"This repository contains a simple 2D Physics engine in C#, with code written by ChatGPT. It uses the console for graphics.\n\n![GPTPhysics](https://user-images.githubusercontent.com/12469377/205753410-030bd615-3084-4ae1-ae3b-40eee32477dc.gif)\n\nChatGPT describes itself as:\n\u003e I am a large language model trained by OpenAI. I generate human-like text based on input.\n\nThe code was generated by a large series of prompts. You can find the entire log in [`prompt-log.md`](prompt-log.md). I made two modifications to the generated code after completing the session; these are noted in the header comment in [`Program.cs`](Program.cs).\n\n## Workarounds\n\nChatGPT's output has a maximum character limit. Sometimes this results in code snippets being cut off halfway. To avoid this, I primed the bot with the following command:\n\n\u003e combine all of the necessary code to create a physics engine into a single C# file. Start printing the file out. Due to your text limitation, printing out the entire code for me will take many steps. When I prompt you with \"continue\", your next response should ONLY contain the next segment of the file. If the final line of code was not written out completely in the previous response, start your next response including that line of code in its entirety.\n\nAnd then manually joined the segmented blocks of code. \n\n## Remarks\n\nMy approach was to instruct ChatGPT to build out the program in a piecemeal way. I typically would ask it to create some boilerplate code first, and then to fill in the gaps. For example, the second prompt is:\n\n\u003e okay, let's do it together. It will use C# language. Write out the boilerplate code to get us started\n\nWhich returns:\n\n```cs\n// Define a class for a 2D physics object\nclass PhysicsObject\n{\n    // Position, velocity, and acceleration vectors\n    Vector2 position;\n    Vector2 velocity;\n    Vector2 acceleration;\n\n    // Mass of the object\n    float mass;\n\n    // Constructor for a new physics object\n    public PhysicsObject(Vector2 pos, Vector2 vel, Vector2 accel, float m)\n    {\n        position = pos;\n        velocity = vel;\n        acceleration = accel;\n        mass = m;\n    }\n}\n\n// Define a class for a 2D physics engine\nclass PhysicsEngine\n{\n    // List of physics objects in the engine\n    List\u003cPhysicsObject\u003e objects;\n\n    // Constructor for a new physics engine\n    public PhysicsEngine()\n    {\n        objects = new List\u003cPhysicsObject\u003e();\n    }\n\n    // Method to update the state of the engine\n    public void Update()\n    {\n        // TODO: Implement physics update code here\n    }\n}\n```\nMy experience was that this often felt more like a master-pupil relationship, rather than between a worker and an assistant. This may be due to my approach of requesting it to build the code up piece by piece (and correcting for errors I spot). As well, ChatGPT's success here is in part due to my prexisting domain knowledge of physics engines, allowing me to spot errors as they arrive.\n\nOften the changes I had to request were fairly small, making the commands feel less like an interaction with an intelligent agent and more like performing non-deterministic compilation of plain english into C# code. Some of these issues, like missing required explicit casts, would be easily resolved if the AI were capable of interacting with an actual C# compiler.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIronWarrior%2FChatGPT-2DPhysics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIronWarrior%2FChatGPT-2DPhysics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIronWarrior%2FChatGPT-2DPhysics/lists"}