{"id":19798632,"url":"https://github.com/eriknyquist/brainfuckintern","last_synced_at":"2025-05-01T05:30:30.080Z","repository":{"id":84199560,"uuid":"92136608","full_name":"eriknyquist/BrainfuckIntern","owner":"eriknyquist","description":"Uses a genetic algorithm to \"evolve\" brainfuck programs with desirable behaviours","archived":false,"fork":false,"pushed_at":"2025-02-08T00:04:52.000Z","size":28034,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T08:34:16.220Z","etag":null,"topics":["artificial-stupidity","brainfuck","brainfuck-programs","c-programming","entertainment","evolutionary-algorithm","evolutionary-algorithms","evolutionary-computation","genetic-algorithm","genetic-algorithms","genetic-programming","research"],"latest_commit_sha":null,"homepage":"https://ekn.io","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eriknyquist.png","metadata":{"files":{"readme":"README.rst","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-23T06:18:33.000Z","updated_at":"2025-02-08T00:04:57.000Z","dependencies_parsed_at":"2024-10-21T16:27:29.489Z","dependency_job_id":null,"html_url":"https://github.com/eriknyquist/BrainfuckIntern","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eriknyquist%2FBrainfuckIntern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eriknyquist%2FBrainfuckIntern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eriknyquist%2FBrainfuckIntern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eriknyquist%2FBrainfuckIntern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eriknyquist","download_url":"https://codeload.github.com/eriknyquist/BrainfuckIntern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251830449,"owners_count":21650802,"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":["artificial-stupidity","brainfuck","brainfuck-programs","c-programming","entertainment","evolutionary-algorithm","evolutionary-algorithms","evolutionary-computation","genetic-algorithm","genetic-algorithms","genetic-programming","research"],"created_at":"2024-11-12T07:30:55.445Z","updated_at":"2025-05-01T05:30:25.064Z","avatar_url":"https://github.com/eriknyquist.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Brainfuck Intern: a very bad brainfuck programmer\n-------------------------------------------------\n\nBrainfuck intern takes a target string as input, e.g. \"Hello, world!\", and uses\nan iterative evolution-like process to produce a\n`Brainfuck \u003chttps://en.wikipedia.org/wiki/Brainfuck\u003e`_ program that prints the\ntarget string.\n\nBrainfuck intern knows nothing about brainfuck syntax (for example, that opening\nloop braces need to be matched with the opposite brace). Brainfuck intern has\nonly the following tools at its disposal;\n\n* A brainfuck interpreter, to execute brainfuck programs and inspect the output\n* Knowledge of valid brainfuck characters (but no knowledge of how to use them;\n  no syntactic knowledge. Can only generate strings containing randomly chosen\n  brainfuck characters)\n* An ability to \"mutate\" brainfuck programs, by randomly changing, adding or\n  removing characters\n* An ability to \"breed\" two brainfuck programs to create new programs, by\n  randomly combining elements of the two original programs\n* An ability to \"assess\" brainfuck programs and their output for fitness, e.g.\n  a brainfuck program that has syntactic errors will not run and the interpreter\n  will return an error. This would be the worst possible fitness level. A program\n  that runs successfully in the interpreter but produces no output would be a\n  slightly better fitness level, but still not great. A program that prints one\n  character would be a better fitness level still, and so on until the best fitness\n  level, which would be a brainfuck program that prints exactly the target string.\n\n*Brainfuck Intern hard at work producing the \"hello world\" program that is shown\nat the end of this README*\n\n.. image:: images/bfintern.gif\n\nSupported Platforms\n===================\n\nLinux \u0026 Windows only. Tested on Debian and Windows 10.\n\nSee `latest release \u003chttps://github.com/eriknyquist/BrainfuckIntern/releases/latest\u003e`_\nfor 32 and 64 bit Windows binaries.\n\nUsage\n=====\n\nRun the ``bfintern`` executable from a terminal (or Command Prompt in Windows)\nwith no arguments to see usage information:\n\n::\n\n    $\u003e bfintern\n\n    Brainfuck Intern (version 2.0)\n\n    Erik Nyquist \u003ceknyquist@gmail.com\u003e)\n\n    Uses a genetic algorithm to mutate strings of random Brainfuck characters\n    until they match a set of user-provided test cases.\n\n    Press Ctrl-C at any time to display the current best Brainfuck program\n    and terminate.\n\n    Usage: ./build/bfintern [OPTIONS] \u003cTESTCASE\u003e [\u003cTESTCASE\u003e, ...]\n\n    POSITIONAL ARGUMENTS:\n\n    One or more test cases, where each test case consists of two ASCII\n    strings separated by a colon ':'. The first string (left side of the\n    colon) will be passed as input to the Brainfuck program under test,\n    and the second string (right side of the colon) is the output that\n    must be produced by the Brainfuck program in order for the test case\n    to pass.\n\n    A test case may also contain a single ASCII string with no colon. In\n    this case, the provided string will be considered the expected output,\n    and no input will passed to the Brainfuck program under test.\n\n    OPTIONS:\n\n    -e \u003celitism\u003e       Defines how many of the best Brainfuck programs are\n                       selected from the population for each cycle of the\n                       evolution process, for breeding \u0026 mutation (0.0 to\n                       1.0, e.g. 0.25 means the top 25% will be selected).\n                       Default is 0.33.\n\n    -c \u003ccrossover\u003e     Defines how many of the selected 'elite' Brainfuck\n                       programs will be 'bred' (randomly mixed/combined)\n                       with other randomly selected programs (0.0 to 1.0,\n                       e.g. 0.75 means 75% of elite programs will be bred).\n                       Default is 0.33.\n\n    -m \u003cmutation\u003e      Defines how many of the selected 'elite' Brainfuck\n                       programs will be randomly mutated (0.0 to 1.0, e.g.\n                       0.44 means 44% of elite programs will be mutated.\n                       Default is 0.33.\n\n    -s \u003csize\u003e          Defines the number of Brainfuck programs in the\n                       population (integer). Default is 1024.\n\n    -l \u003csize\u003e          Defines the maximum size in bytes of each\n                       generated Brainfuck program in the population.\n                       Default is 4096.\n\n    -o \u003cnum\u003e           Once evolution has produced a correct Brainfuck\n                       program (passes all test cases), continue evolving\n                       for an additional \u003cnum\u003e generations to attempt to\n                       shorten the Brainfuck program by removing unnecessary\n                       characters (-1 to optimise infinitely). Default is 1000.\n\n    -r \u003cseed\u003e          Fixed seed value to seed random number generation.\n                       The current time (seconds) is used by default.\n\n    -q                 Do not show evolution progress by printing status and\n                       fittest BF program at each improved generation (default\n                       behaviour). Instead, only print the fittest Brainfuck\n                       program on termination (Ctrl-C).\n\n    -h                 Show this text and exit.\n\n    EXAMPLES:\n\n    Produce a program that prints \"Hello, world!\":\n\n        ./build/bfintern \"Hello, world!\"\n\n    Produce a program that prints \"Hello, world!\", with custom seed,\n    mutation and elitism values provided:\n\n        ./build/bfintern -r 123456 -m 0.75 -e 0.1 \"Hello, world!\"\n\n    Produce a program that prints \"true\" when input is \"1\", and prints\n    \"false\" when the input is \"0\":\n\n        ./build/bfintern \"0:false\" \"1:true\"\n\nHello, world! by Brainfuck Intern\n=================================\n\nBrainfuck intern created this beautiful Brainfuck program after a minute or so\nof smashing random bits of garbage together. This program prints \"Hello, world!\"\n\n::\n\n    -\u003e+-\u003e++++++[+++++++++++++++++++++++++++++++++++++++++++\u003e+++++++++++++++++++\n    +++[+++++++++++\u003c][]\u003e++++-+++++++++.+++++++++++++++++++++++++++++.-++++++++.\n    .+++.+++++++\u003e+++++++++++-+.---------+----.-\u003c+[.--+---[----.++-+-++.------.-\n    ----[---.-+\u003c]]\u003e+-++--+\u003e--++++.-+\u003e]+-\u003e]\n\nPersonal testimony from Xzibit\n==============================\n\n.. image:: images/x.jpg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feriknyquist%2Fbrainfuckintern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feriknyquist%2Fbrainfuckintern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feriknyquist%2Fbrainfuckintern/lists"}