{"id":15048962,"url":"https://github.com/jerr-it/cellmaker","last_synced_at":"2025-04-10T01:34:43.185Z","repository":{"id":115923917,"uuid":"266811196","full_name":"jerr-it/cellmaker","owner":"jerr-it","description":"Multi-threaded library for cellular automata","archived":false,"fork":false,"pushed_at":"2021-10-11T21:06:08.000Z","size":42,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T03:12:19.153Z","etag":null,"topics":["c","c-language","cellular-automata","cellular-automaton","conways-game-of-life","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"C","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/jerr-it.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}},"created_at":"2020-05-25T15:12:55.000Z","updated_at":"2024-12-22T21:14:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"59a20aff-8068-4efa-8d58-0d2926c97530","html_url":"https://github.com/jerr-it/cellmaker","commit_stats":null,"previous_names":["cherrysrc/cellmaker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcellmaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcellmaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcellmaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcellmaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerr-it","download_url":"https://codeload.github.com/jerr-it/cellmaker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248140946,"owners_count":21054372,"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":["c","c-language","cellular-automata","cellular-automaton","conways-game-of-life","hacktoberfest"],"created_at":"2024-09-24T21:17:21.501Z","updated_at":"2025-04-10T01:34:43.141Z","avatar_url":"https://github.com/jerr-it.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCellmaker\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/-Language-blue?style=for-the-badge\u0026logo=c\" /\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\nLibrary for simulation of cellular automata, like Conways Game of Life\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"img/one.png\" width=100/\u003e\n    \u003cimg src=\"img/two.png\" width=100/\u003e\n    \u003cimg src=\"img/three.png\" width=100/\u003e\n    \u003cimg src=\"img/four.png\" width=100/\u003e\n    \u003cimg src=\"img/five.png\" width=100/\u003e\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eHow to use\u003c/h2\u003e\n\nCompile:\n```\nmake \n./main\n\nor\n\ngcc -o automaton main.c CellularAutomata/CellularAutomaton.h CellularAutomata/CellularAutomaton.c\n./automaton\n```\n\nVisit main.c for complete file example.\n\nInclude:\n```c\n#include \"CellularAutomata/CellularAutomaton.h\"\n```\n\n\nDefine your rules:\n```c\n//At what neighbor count will a cell survive the current iteration?\nunsigned int survive[] = { 2, 3 };\nsize_t       sSize     = sizeof(survive) / sizeof(unsigned int);\n\n//At what neighbor count will a cell get revived in the current iteration?\nunsigned int revive[] = { 3 };\nsize_t       rSize    = sizeof(revive) / sizeof(unsigned int);\n```\n\nCreate from array:\n```c\nbool arr[] =\n{\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 1, 0, 0, 1, 0, 0, 0,\n    0, 0, 1, 0, 1, 1, 0, 1, 0, 0,\n    0, 0, 0, 1, 0, 0, 1, 0, 0, 0,\n    0, 0, 0, 1, 0, 0, 1, 0, 0, 0,\n    0, 0, 1, 0, 1, 1, 0, 1, 0, 0,\n    0, 0, 0, 1, 0, 0, 1, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n};\n CellularAutomaton autom = newAutomatonFromArray(arr, survive, sSize, revive, rSize, 10, 10);\n```\n\n\u003cb\u003eKeep in mind that this wraps around the edges, meaning that e.g. cells at the right edge neighbor the cells on the left edge.\u003c/b\u003e\n\nInitialize randomly:\n```c\nsrand(time(NULL));\n//0.4 means the area will be alive by 40%\nCellularAutomaton autom = newAutomaton(survive, sSize, revive, rSize, 0.4, 20, 20);\n```\n\nRun steps:\n```c\nfor (int i = 0; i \u003c 40; i++)\n{\n    print(autom);\n    tick(autom);\n    printf(\"\\n\");\n}\n```\n\n\u003cb\u003ePrint will print the automaton onto the console. However you can render it however you like by accessing the automatons buffer directly. It's a linear array of bools. Retrieve it by using:;\u003c/b\u003e\n\n```c\nbool* usedBuffer = currentBuffer(autom);\n```\n\nFree memory:\n```c\nfreeAutomaton(autom);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr-it%2Fcellmaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerr-it%2Fcellmaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr-it%2Fcellmaker/lists"}