{"id":19876707,"url":"https://github.com/dirktoewe/game_of_pyth","last_synced_at":"2026-06-29T03:31:46.385Z","repository":{"id":176082575,"uuid":"62840503","full_name":"DirkToewe/game_of_pyth","owner":"DirkToewe","description":"Convay's Game of Life implemented in Python (My first baby steps with Python).","archived":false,"fork":false,"pushed_at":"2016-07-14T16:50:18.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-20T20:29:52.868Z","etag":null,"topics":["game-of-life","python"],"latest_commit_sha":null,"homepage":null,"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/DirkToewe.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":"2016-07-07T21:55:55.000Z","updated_at":"2016-07-07T22:21:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"5dbbc821-43ea-43de-b2b8-4a6436eff95b","html_url":"https://github.com/DirkToewe/game_of_pyth","commit_stats":null,"previous_names":["dirktoewe/game_of_pyth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DirkToewe/game_of_pyth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgame_of_pyth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgame_of_pyth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgame_of_pyth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgame_of_pyth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DirkToewe","download_url":"https://codeload.github.com/DirkToewe/game_of_pyth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgame_of_pyth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34912252,"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-29T02:00:05.398Z","response_time":58,"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":["game-of-life","python"],"created_at":"2024-11-12T16:33:58.727Z","updated_at":"2026-06-29T03:31:46.360Z","avatar_url":"https://github.com/DirkToewe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Game of Pyth(on)\n================\n\nGame of Pyth is my first Python project. It is an implementation of [Convay's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life).\n\n\u003cimg src=\"https://github.com/DirkToewe/game_of_pyth/blob/master/game_of_python.png\" width=\"60%\"\u003e\n\nBoard\n=====\n\nThe ```Board``` represents the current state of the simulation and keeps track of the living cells. The ```increment()``` method advances the Game of Life simulation by a single time step. For a ```Board``` ```board``` the ```board[row: int, col: int]``` method returns True if and only if the cell at row row and column col is alive. With ```board[row,col] = new_state``` changes the board state of a cell. All currently living cells can be iterated:\n\n```python\nfor row,col in board:\n  print( 'cell (%(row)d,%(col)d) lives' % locals() )\n```\n\nDenseBoard\n-----------\n\nThe ```DenseBoard``` has a finite size of ```nRows```⨯```nCols``` cells. The board behaves, as if it was the surface of a toroid: the left and right side as well as top and bottom are connected to one another. The ```DenseBoard``` can be converted to a multi-line string representation using the str() method. The dense board can be crated from a twodimensional iterable:\n```python\nfrom org.jengineering import GameOfPyth\n\nboard = GameOfPyth.DenseBoard(\n  [[0]*18]*4 +\n  [[0]*5+[1,1,1,1,1,1,1,1]+[0]*5,\n   [0]*5+[1,0,1,1,1,1,0,1]+[0]*5,\n   [0]*5+[1,1,1,1,1,1,1,1]+[0]*5] +\n  [[0]*18]*4\n)\n```\n\n```DenseBoard``` can also be created from a...:\n  * set[(int,int)] storing the living cell entries\n  * map[(int,int),bool] representing cell states or a, which represents the alive (True) and dead (False) state for (some) cells\n  * callable (int,int) -\u003e bool, which returns True if a cell at the given input index is alive\n\n```python\nboard = GameOfPyth.DenseBoard(56,56,lambda r,c: random() \u003c 0.1)\n```\n\nSparseBoard\n-----------\n\n```SparseBoard``` has a potentially infinite number of cells. It can be created from a ```set[(int,int)]```:\n\n```python\nboard = GameOfPyth.SparseBoard(\n  set([(0,1), (3,3), (2,1), (1,0), (0,3), (3,4), (2,4), (3,5)])\n)\n```\n\nSince ```Board``` is an ```iterable[(int,int)]```, a ```DenseBoard``` can easily be converted to a ```SparseBoard```:\n\n```python\nboard = GameOfPyth.SparseBoard(\n  set(GameOfPyth.DenseBoard([\n    [1,1,1,0,1],\n    [1,0,0,0,0],\n    [0,0,0,1,1],\n    [0,1,1,0,1],\n    [1,0,1,0,1]\n  ]))\n)\n```\n\nVisualization\n=============\n\nThe ```GameOfPyth.Widget``` allows You to display the ```Board```, run the simulation and vary the simulation speed. The mouse wheel allows You to zoom. Holding down the primary mouse button scrolls the view.\n\n```python\nfrom PyQt4.QtGui import QApplication\nimport sys\n\napp = QApplication(sys.argv)\nwdgt = GameOfPyth.Widget(board)\nwdgt.setGeometry(200,200,800,600)\nwdgt.show()\nsys.exit( app.exec_() )\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirktoewe%2Fgame_of_pyth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirktoewe%2Fgame_of_pyth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirktoewe%2Fgame_of_pyth/lists"}