{"id":21284191,"url":"https://github.com/fer14/3-body-problem","last_synced_at":"2025-04-14T13:32:48.552Z","repository":{"id":205351072,"uuid":"714034711","full_name":"Fer14/3-body-problem","owner":"Fer14","description":"A simple Python-based simulation of the three-body problem using Pygame.","archived":false,"fork":false,"pushed_at":"2024-02-07T21:39:41.000Z","size":4284,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:39:03.168Z","etag":null,"topics":["body-problem","physics","planets","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fer14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-03T19:10:34.000Z","updated_at":"2025-03-03T09:09:39.000Z","dependencies_parsed_at":"2024-02-07T22:48:14.674Z","dependency_job_id":null,"html_url":"https://github.com/Fer14/3-body-problem","commit_stats":null,"previous_names":["fer14/n-body-problem","fer14/3-body-problem"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fer14%2F3-body-problem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fer14%2F3-body-problem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fer14%2F3-body-problem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fer14%2F3-body-problem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fer14","download_url":"https://codeload.github.com/Fer14/3-body-problem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248888817,"owners_count":21178112,"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":["body-problem","physics","planets","simulation"],"created_at":"2024-11-21T11:14:51.980Z","updated_at":"2025-04-14T13:32:48.517Z","avatar_url":"https://github.com/Fer14.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N-Body Problem Python Simulation\n\n![logo](imgs/black.png)\n\nA simple Python-based simulation of the three-body problem using Pygame.\n\n\n## Introduction\n\nThis Python code provides a basic simulation of the three-body problem, which is a classical problem in physics and celestial mechanics. The simulation uses Pygame for visualization and allows you to observe the interactions between three celestial bodies under the influence of gravitational forces.\n\n\n[3bodies.webm](https://github.com/Fer14/n-body-problem/assets/36365106/dfaacd8a-d0b5-47f4-bae2-4d93761aa4b8)\n\n\n\n## Features\n\n- Simulate the motion of three celestial bodies under gravity.\n- Customize initial conditions and parameters.\n- Observe the dynamic behavior of the n-body system.\n- Add more bodies to see how do they all interact with each other\n\n## Requirements\n\nTo run this code, you need:\n\n    Python 3.x\n\n## Installation\n\nClone the repository:\n\n```bash\ngit clone https://github.com/Fer14/n-body-problem\n```\n\nChange into the project directory:\n\n```bash\ncd n-body-problem\n``````\n\nInstall the necessary libraries:\n\n```bash\npip install -r requirements.txt\n```\n\n## Usage\n\nRun the simulation:\n\n```bash\npython app.py\n```\n\nObserve the three-body simulation and interact with it using Pygame's window. \nBy clicking in the space you will add more bodies to the simulation as shown in the next video:\n\n[nbodies.webm](https://github.com/Fer14/n-body-problem/assets/36365106/a14fd4c5-7334-4e39-bdba-64de128d12b2)\n\n### Options\n\n- `--width`: (Default: 800) - Width of the screen.\n- `--height`: (Default: 600) - Height of the screen.\n- `--max_bodies`: (Default: 10) - Maximum number of bodies to add to the simulation.\n- `--rebound_factor`: (Default: 0.5) - Factor strength to apply when bodies bounce off the limits of the screen.\n- `--mass`: (Default: 10) - Default mass of the bodies.\n- `--g`: (Default: 9.8) - The gravitational constant.\n- `--clock`: (Default: 60) - Framerate to delay the game to the given ticks.\n\n### Example\n\n```bash\npython app.py --width 1200 --height 800 --max_bodies 20\n```\n\n\n\n## Customization\n\nYou can customize the simulation by editing the following parameters in the code:\n\n- Initial positions and velocities of the particles in main.py.\n- Gravitational constant (G) and masses of the particles in main.py.\n- Screen dimensions and simulation settings in main.py.\n\nFeel free to experiment with different initial conditions and parameters to observe various behaviors of the three-body system.\n\n\n## Contributing\n\nIf you would like to contribute to this project, please follow these steps:\n\n- Fork the repository on GitHub.\n- Clone the forked repository to your local machine.\n- Create a new branch for your feature or bug fix.\n- Implement your changes and test them.\n- Commit your changes with descriptive commit messages.\n- Push the changes to your fork on GitHub.\n- Create a pull request to the original repository.\n\n![logo](imgs/white.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffer14%2F3-body-problem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffer14%2F3-body-problem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffer14%2F3-body-problem/lists"}