{"id":20354937,"url":"https://github.com/grayhatdevelopers/gameoflife_cpp","last_synced_at":"2026-06-01T06:31:27.085Z","repository":{"id":117960597,"uuid":"210203808","full_name":"grayhatdevelopers/GameofLife_Cpp","owner":"grayhatdevelopers","description":"Simple Game of Life simulation written in C++, working in the console.","archived":false,"fork":false,"pushed_at":"2019-09-22T19:47:52.000Z","size":545,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T17:35:42.374Z","etag":null,"topics":["console-application","cpp","mathematics","simulation","student-project"],"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/grayhatdevelopers.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-22T19:37:53.000Z","updated_at":"2020-08-24T12:19:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"39d5612f-4e96-446e-bc37-9885ca511345","html_url":"https://github.com/grayhatdevelopers/GameofLife_Cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grayhatdevelopers/GameofLife_Cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayhatdevelopers%2FGameofLife_Cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayhatdevelopers%2FGameofLife_Cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayhatdevelopers%2FGameofLife_Cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayhatdevelopers%2FGameofLife_Cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grayhatdevelopers","download_url":"https://codeload.github.com/grayhatdevelopers/GameofLife_Cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayhatdevelopers%2FGameofLife_Cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33763648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["console-application","cpp","mathematics","simulation","student-project"],"created_at":"2024-11-14T23:10:28.824Z","updated_at":"2026-06-01T06:31:27.080Z","avatar_url":"https://github.com/grayhatdevelopers.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GameofLife_Cpp\nSimple Game of Life simulation written in C++, working in the console.\nAuthor: Saad Bazaz\n\n\nHello there, dear math enthusiast.\nI guarantee you that each and every line of code is my own. \nAll from my mind.\n\nExcept for that cool graphic I got off the internet.\n\nAs proof I've attached all the test runs I had. I started with the fileHandler so there's plenty of funny material to go around.\n\n\nOverview of the program:\n- config.ini is the last saved User Configuration i.e. the settings before launching a simulation. It helped me through testing so that's why I started from here.\nconfig.ini is parsed through the code I've written. Any other settings might throw an error or give weird results.\n- So for that I gave the option of overwriting config.ini with a new Configuration - right inside the program. This ensures uniform file structure.\n- The program maintains a log of the current simulation in a temp file called recent_sim.temp\nThis file is maintained until the end of the simulation. If the user wishes to save, this temp file is copied onto the User's desired file and then deleted in all cases, to save system space.\n- I am horrible at math. But I still wrote an algorithm of sorts. There are 2 main vectors - \"alive\" (living cells) and \"neighbors\" (dead cells). These contain the main information\nregarding the current cells in the grid.\n\nSTEPS OF ALGORITHM:\n1. Initialize \"alive\" with values from userConfig.\n2. Display the current values inside \"alive\".\n3. Clear \"neighbors\" and all temporary vectors\n4. Now create new neighbors. We will only check if the space isn't occupied by an \"alive\" cell, otherwise all neighbors will be entered. Even if it results in duplication (important)\n5. Then we scan the array and remove duplicates. During this, we check how many times a duplicate appears. If it appears 3 times, that means that that space is neighbored by 3 \"alive\" cells.\n6. We record all such \"births\" into a tempBirth vector.\n7. Next we scan the \"alive\" vector for any deaths. We check deaths using a for loop in which we check the number of neighbors of a cell. If that number becomes greater than 4 *during* the loop,\nwe break because that already means that the cell is dead. This saves us some time.\n8. We cannot start removing values immediately as the Rule of Death requires that all the \"alive\" cells be there to be counted. So instead, we record all the indexes at which deaths occur.\n9. After scanning is done, we remove or \"kill\" all the cells in our death record.\n10. Finally, we append the \"tempBirth\" vector onto the \"alive\" vector.\n11. Our new generation is now ready.\n\nDon't know if it's an O(n) algorithm. Contributions would be appreciated.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayhatdevelopers%2Fgameoflife_cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrayhatdevelopers%2Fgameoflife_cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayhatdevelopers%2Fgameoflife_cpp/lists"}