{"id":23666517,"url":"https://github.com/hugcis/fast_eca","last_synced_at":"2025-09-10T12:38:22.818Z","repository":{"id":109704975,"uuid":"270612364","full_name":"hugcis/fast_eca","owner":"hugcis","description":"A fast C implementation of ECAs","archived":false,"fork":false,"pushed_at":"2020-06-18T08:17:49.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T07:43:55.443Z","etag":null,"topics":["automaton","c","cellular-automata","cellular-automaton","ecas"],"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/hugcis.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":"2020-06-08T09:43:09.000Z","updated_at":"2020-06-18T08:17:52.000Z","dependencies_parsed_at":"2023-03-26T12:32:58.416Z","dependency_job_id":null,"html_url":"https://github.com/hugcis/fast_eca","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hugcis/fast_eca","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Ffast_eca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Ffast_eca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Ffast_eca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Ffast_eca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugcis","download_url":"https://codeload.github.com/hugcis/fast_eca/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Ffast_eca/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274463445,"owners_count":25290113,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"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":["automaton","c","cellular-automata","cellular-automaton","ecas"],"created_at":"2024-12-29T07:32:40.151Z","updated_at":"2025-09-10T12:38:22.770Z","avatar_url":"https://github.com/hugcis.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast and minimal C ECA implementation\n\n## Methods\n\nThe following methods are available in the header\n`\"fast_eca/wolfram_automaton.h\"`:\n\n- `autom_t* create_automat(size_t size, int states)`: This creates a pointer to\n  an `autom_t` structure, representing an automaton of size `size` with `states`\n  states.\n- `int init_automat(autom_t* autom, enum InitMode mode)`: Initializes the\n  automaton with:\n  1. One cell in state `1` in the middle of the grid and the rest to `0` if `mode == ONE`\n  2. Random  states if `mode == RANDOM`\n- `uint8_t* rule_from_number(unsigned long rule_number, int states, int\n  neighbors)`: Creates an ECA rule (array of uint8_t) from its number, number of\n  states and neighborhood size.\n- `int update_step(autom_t* autom, uint8_t* rule, int radius)`: Updates the\n  automaton one step at a time with the rule and radius (radius is `neighbords/2 - 1`).\n- `int print_autom(autom_t* autom, char* buf)`: Format the automaton to a\n  buffer. The buffer needs to be allocated to at least the size of `(size + 1) char`.\n\n## Try it out\n\nClone this folder in your project. \n```\ngit clone https://github.com/hugcis/fast_eca.git\n```\n\nPut this C code into a file `main.c`, next to the folder `fast_eca`:\n``` C\n#include \u003cstdio.h\u003e\n#include \u003cinttypes.h\u003e\n#include \"fast_eca/wolfram_automaton.h\"\n\nint main(int argc, char** argv) {\n  size_t size = atoi(argv[1]);\n  int neighbors = 3;\n  int radius = (neighbors - 1) / 2;\n  int states = 2;\n\n  uint8_t* rule = rule_from_number(atoi(argv[2]), states, neighbors);\n  autom_t* autom = create_automat(size, states);\n  char* buf = calloc(size + 1, sizeof(char));\n  init_automat(autom, ONE);\n\n  for (int i = 0; i \u003c 100; ++i) {\n    update_step(autom, rule, radius);\n    print_autom(autom, buf);\n    fprintf(stdout, \"%s\\n\", buf);\n  }\n}\n```\n\nCompile with the following command:\n```\ngcc -O3 -o main main.c -I. fast_eca/wolfram_automaton.c\n```\n\nAnd run (Grid size 100, rule 110)\n```\n./main 100 110\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugcis%2Ffast_eca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugcis%2Ffast_eca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugcis%2Ffast_eca/lists"}