{"id":27183166,"url":"https://github.com/boreec/brian-s-brain","last_synced_at":"2025-04-09T15:55:32.710Z","repository":{"id":217097548,"uuid":"631219527","full_name":"boreec/Brian-s-Brain","owner":"boreec","description":"Implementation of the cellular automaton called \"Brian's Brain\" in rust with Vulkan API.","archived":false,"fork":false,"pushed_at":"2024-01-14T09:17:57.000Z","size":190,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-14T15:24:38.215Z","etag":null,"topics":["brians-brain","cellular-automaton","rust","rust-lang","vulkan","vulkan-api","vulkano"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/boreec.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}},"created_at":"2023-04-22T10:17:48.000Z","updated_at":"2024-01-14T15:24:40.186Z","dependencies_parsed_at":"2024-01-14T15:24:40.076Z","dependency_job_id":"5c26c862-7050-4f28-8a34-f07c192a1eca","html_url":"https://github.com/boreec/Brian-s-Brain","commit_stats":null,"previous_names":["boreec/brian-s-brain"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2FBrian-s-Brain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2FBrian-s-Brain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2FBrian-s-Brain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2FBrian-s-Brain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boreec","download_url":"https://codeload.github.com/boreec/Brian-s-Brain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065108,"owners_count":21041867,"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":["brians-brain","cellular-automaton","rust","rust-lang","vulkan","vulkan-api","vulkano"],"created_at":"2025-04-09T15:55:31.468Z","updated_at":"2025-04-09T15:55:32.705Z","avatar_url":"https://github.com/boreec.png","language":"Rust","readme":"# Brian's brain (by Cyprien Borée)\n\nThis project is an implementation of the cellular automaton called \n[Brian's Brain](https://en.wikipedia.org/wiki/Brian%27s_Brain). It was made  with \n[Rust](https://en.wikipedia.org/wiki/Rust_(programming_language)) and \n[Vulkan](https://en.wikipedia.org/wiki/Vulkan)'s' graphics API.\n\nSee all my projects and more on [boreec.github.io/projects](https://boreec.github.io/projects/)\n\n# Video\n\n[![Watch the video](https://img.youtube.com/vi/r0fTs15-Qg0/default.jpg)](https://youtu.be/r0fTs15-Qg0)\n\n# Images\n\n\u003cimg src=\"img/ca.png\" alt=\"Cellular Automaton\" width=\"200\"/\u003e\n\u003cimg src=\"img/ca_example1.png\" alt=\"Example #1\" width=\"200\"/\u003e\n\u003cimg src=\"img/ca_example2.png\" alt=\"Example #2\" width=\"200\"/\u003e\n\u003cimg src=\"img/ca_example3.png\" alt=\"Example #3\" width=\"200\"/\u003e\n\n# User manual\n\n## Compilation\n\nFirst of all, rust language has to be installed (see [here](https://www.rust-lang.org/tools/install)).\n\nThe program can be run in a GUI (a CLI version exists), in order to do so, Vulkan API has to be \ninstalled on the system (if `vkcube` test program can be executed, it's good).\n\nAdditionally, basic packages (`build-essential`, `cmake`) and other languages packages (`g++`, `python3`)\nare required by dependencies for a complete compilation.\n\nFinally, the program can be built with `cargo`.\n```console\nuser:~$ cargo build --release \n```\n\n## Execution\n\nWhen it's compiled properly, the executable will be placed into `target/release/`.\n\nThere are two ways to execute it. The first one is by simply using its path:\n\n```console\nuser:~$ ./target/release/brian-s-brain\n```\n\nThe other way is to use `cargo`:\n\n```console\nuser:-$ cargo run\n```\n\n### Arguments\n\nNote that to provide arguments through `cargo run`, they have to be separated with `--`.\n\nThe executable can be provided with arguments (see them with `--help` or `-h`) :\n\n```console\nuser:-$ cargo run -- --help\nprogram to run the Brian's Brain cellular automaton\n\nUsage: brian-s-brain [OPTIONS]\n\nOptions:\n  -b, --benchmark\n          Do 100 runs of the program and for each of them:\n          \n          1. Declare the size of the cellular automaton to be 100x100 (`WorldState::new()`)\n          2. Initialize the world with 50% random noise (`WorldState::randomize()`)\n          3. Do 100 iterations (`WorldState::next()`)\n          \n          Then, the average execution time for each call is displayed.\n\n      --cli\n          Run the program in the terminal. Note that if the cellular automaton's environment is too huge, render may fail\n\n      --example \u003cEXAMPLE\u003e\n          Run the program with a specific start.\n          \n          - `--example=1` depicts 5 period-3 oscillators.\n          - `--example=2` depicts gliders creating a breeder.\n          - `--example=3` depicts a wick.\n          \n          [default: 0]\n\n  -f, --framerate \u003cFRAMERATE\u003e\n          The number of time between two frames (in milliseconds). if the value is not specified, the display rate will be as fast as possible\n          \n          [default: 0]\n\n  -g, --gui\n          Run the program with a graphical user interface. This is the default mode if no other viewing modes is selected\n\n  -i, --iter \u003cITER\u003e\n          The number of iterations to run for\n          \n          [default: 100]\n\n  -r, --randomness \u003cRANDOMNESS\u003e\n          The percentage of cell alive at the beginning. The cells are chosen randomly\n          \n          [default: 0.5]\n\n  -s, --size \u003cSIZE\u003e\n          The size of the world in which the cells live\n          \n          [default: 10]\n\n  -h, --help\n          Print help information (use `-h` for a summary)\n\n  -V, --version\n          Print version information\n```\n#### Examples\n\nInitialize a world 100x100, with 3% alive cells and run it in the terminal \nfor 100 iterations:\n\n```console\nuser:~$ cargo run --release -- --cli --iter=100 --size=100 --randomness=0.03\n```\n\nInitialize a world 50x50, with 60% alive cells and run in a GUI for 1000 iterations:\n\n```console\nuser:~$ cargo run --release -- --gui --iter=1000 --size=50 --randomness=0.6\n```\n\nRun the examples\n\n```console\nuser:~$ cargo run --release -- --example=1\nuser:~$ cargo run --release -- --example=2\nuser:~$ cargo run --release -- --example=3\n```\n        \n\n# Programmer manual\n\n## Documentation\n\nThe documentation can be generated with `cargo`:\n\n```console\nuser:~$ cargo doc\n```\n\nThe generated files will be placed in `target/doc/brian_s_brain` and the entry point is accessed by `index.html`.\n\nTo view the file, `cargo` can use the default web browser on the system with:\n\n```console\nuser:~$ cargo doc --open\n```\n\n## Unit Tests\n\nI wrote unit tests to assert the good behaviour of the cellular automaton (represented by `WorldState` struct). \n`cargo` can run the tests as follows:\n\n```console\nuser:~$ cargo test --release\n```\n\n## Benchmark\n\nUse `--benchmark` to check the time taken by the main functions:\n\n```console\nuser:~$ cargo run --release -- --benchmark\nBenchmark - 100 runs average\nWorldState::new()        \t275ns\nWorldState::randomize()  \t111.924µs\nWorldState::next() (x100)\t20.23769ms\ntotal:                   \t20.349889ms\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboreec%2Fbrian-s-brain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboreec%2Fbrian-s-brain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboreec%2Fbrian-s-brain/lists"}