{"id":22883196,"url":"https://github.com/bradrn/cellular-automata","last_synced_at":"2025-03-31T16:52:31.013Z","repository":{"id":106385840,"uuid":"167950849","full_name":"bradrn/cellular-automata","owner":"bradrn","description":"A Haskell library for cellular automata","archived":false,"fork":false,"pushed_at":"2020-07-15T01:36:13.000Z","size":75,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-06T22:14:55.001Z","etag":null,"topics":["cellular-automata","cellular-automaton","cellular-automatons","haskell","haskell-library","library"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","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/bradrn.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-01-28T11:26:31.000Z","updated_at":"2021-09-17T16:49:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"50516358-bbb6-4a14-9468-99710af5d421","html_url":"https://github.com/bradrn/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/bradrn%2Fcellular-automata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradrn%2Fcellular-automata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradrn%2Fcellular-automata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradrn%2Fcellular-automata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradrn","download_url":"https://codeload.github.com/bradrn/cellular-automata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246500470,"owners_count":20787700,"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","cellular-automaton","cellular-automatons","haskell","haskell-library","library"],"created_at":"2024-12-13T18:32:55.457Z","updated_at":"2025-03-31T16:52:30.985Z","avatar_url":"https://github.com/bradrn.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cellular-automata\n\n`cellular-automata` is a flexible library for the simulation of cellular\nautomata (henceforth CA/CAs). It is based around a new typeclass which can\nrepresent cellular automata with arbitrary topologies (introduced [here](https://www.reddit.com/r/haskell/comments/a2vnni/a_better_comonad_for_cellular_automata/)).\nIt also contains some data types for various kinds of CA universes, as well as\nseveral utility functions.\n\n## Examples\n\nThe examples below can be run by calling\n`evolve _selectedRule _myUniverse`; this will evolve `_myUniverse` by\none generation according to the selected rule.\n\n```haskell\n-- Conway's Game of Life. (Included in the CA.Utils module)\nconwayLife :: CARule Point Bool\n-- Note the type signature above: it states that conwayLife operates\n-- on universes which use 2D points ('Point'), with state type 'Bool'.\nconwayLife curPoint curUniverse =\n    case (peek curPoint curUniverse) of\n        False -\u003e if surrounds == 3          then True else False\n        True  -\u003e if surrounds `elem` [2, 3] then True else False\n  where\n    -- The number of surrounding 'True' cells\n    surrounds = count id $\n        fmap (`peek` cur_universe) $ moore False curPoint\n\n-- Wolfram's Rule 30\nrule30 :: CARule Int Bool\n-- Again, the type signature states that rule30 operates on universes\n-- which use 1D points ('Int'), with state type 'Bool'.\nrule30 curPoint curUniverse =\n    let left  = peek (p-1) s\n        mid   = peek  p    s\n        right = peek (p+1) s\n    in\n        (    left \u0026\u0026 not mid \u0026\u0026 not right)\n     || (not left \u0026\u0026     mid \u0026\u0026     right)\n     || (not left \u0026\u0026     mid \u0026\u0026 not right)\n     || (not left \u0026\u0026 not mid \u0026\u0026     right)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradrn%2Fcellular-automata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradrn%2Fcellular-automata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradrn%2Fcellular-automata/lists"}