{"id":18431287,"url":"https://github.com/zhan3333/python-cellular-automata","last_synced_at":"2025-04-07T18:32:38.301Z","repository":{"id":102225586,"uuid":"84735834","full_name":"zhan3333/python-Cellular-automata","owner":"zhan3333","description":"元胞自动机 Python 实现、康威生命游戏 / Cellular Automata With Python, Conway's Game of Life","archived":false,"fork":false,"pushed_at":"2023-01-09T10:09:18.000Z","size":196,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T22:24:55.583Z","etag":null,"topics":["cellular-automata","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/zhan3333.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":"2017-03-12T15:23:56.000Z","updated_at":"2025-03-12T04:19:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"f524a778-e27a-4add-8f27-a766eee1ce88","html_url":"https://github.com/zhan3333/python-Cellular-automata","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/zhan3333%2Fpython-Cellular-automata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fpython-Cellular-automata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fpython-Cellular-automata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fpython-Cellular-automata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhan3333","download_url":"https://codeload.github.com/zhan3333/python-Cellular-automata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247707402,"owners_count":20982778,"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":["cellular-automata","python","python3"],"created_at":"2024-11-06T05:24:13.655Z","updated_at":"2025-04-07T18:32:38.294Z","avatar_url":"https://github.com/zhan3333.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## What is it?\n\n元胞自动机（Cellular Automata） 是 20 世纪50 年代初由计算机之父冯·诺依曼（J.von Neumann） 为了模拟生命系统所具有的自复制功能而提出来的。此后，史蒂芬·沃尔夫勒姆（Stephen Wolfram） 对元胞自动机理论进行了深入的研究，例如，他对一维初等元胞机全部256 种规则所产生的模型进行了深入研究，并将元胞自动机分为平稳型、周期型、混沌型和复杂型4 种类型。元胞自动机采用离散的空间布局和离散的时间间隔，将元胞分成有限种状态，元胞个体状态的演变仅与其当前状态以及其某个局部邻域的状态有关。\n\n## How to run?\n\n- Need `Python3` and `pip3`\n  - `pip install pygame` \n  - `python3 ./cellular_automata.py`\n\n## Features\n\n- 重构：使用更少的代码实现\n- 每个单元的下一个状态，取决于相邻8个单元的状态\n- 每 tick 只绘制变化了的单元\n- 容器上下互联、左右互联\n- Class 储存状态\n- 空格暂停/恢复程序运行\n\n## Rule\n\n- 当前细胞为存活状态时，当周围的存活细胞低于2个时（不包含2个），该细胞变成死亡状态。（模拟生命数量稀少）\n- 当前细胞为存活状态时，当周围有2个或3个存活细胞时，该细胞保持原样。\n- 当前细胞为存活状态时，当周围有超过3个存活细胞时，该细胞变成死亡状态。（模拟生命数量过多）\n- 当前细胞为死亡状态时，当周围有3个存活细胞时，该细胞变成存活状态。（模拟繁殖）\n\n## How it works?\n\n利用 pygame 库，将程序屏幕划分为 x * x 元胞自动机格大小，每格维护自己的状态，每 tick 按照原胞自动机的原理更新所有格的状态，并渲染出不同的颜色。\n\n## How is the effect?\n\n![](./元胞自动机.gif)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhan3333%2Fpython-cellular-automata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhan3333%2Fpython-cellular-automata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhan3333%2Fpython-cellular-automata/lists"}