{"id":16334960,"url":"https://github.com/pta2002/bfgame","last_synced_at":"2025-05-16T09:34:09.119Z","repository":{"id":94209418,"uuid":"76404189","full_name":"pta2002/bfgame","owner":"pta2002","description":"A brainfuck game engine. Yes, seriously.","archived":false,"fork":false,"pushed_at":"2016-12-15T22:29:14.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T20:26:40.560Z","etag":null,"topics":["brainfuck","brainfuck-game-engine"],"latest_commit_sha":null,"homepage":"","language":"Python","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/pta2002.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":"2016-12-13T22:34:51.000Z","updated_at":"2023-07-18T15:19:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2cf823a-a655-449a-9a82-29b89665488e","html_url":"https://github.com/pta2002/bfgame","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/pta2002%2Fbfgame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pta2002%2Fbfgame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pta2002%2Fbfgame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pta2002%2Fbfgame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pta2002","download_url":"https://codeload.github.com/pta2002/bfgame/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254504711,"owners_count":22082074,"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":["brainfuck","brainfuck-game-engine"],"created_at":"2024-10-10T23:39:43.246Z","updated_at":"2025-05-16T09:34:09.073Z","avatar_url":"https://github.com/pta2002.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"SPEC!\r\n---\r\n`bfgame` is a brainfuck game engine (yes, seriously). This is its spec.\r\n\r\n# Memory (a.k.a. \"tape\")\r\nbfgame's memory space consists of a 'tape' with infinite cells, and a pointer, which you can move with the `\u003c` and `\u003e` operators.\r\n\r\nIn bfgame, each cell can hold an arbitrarily large integer.\r\n\r\nThe first five cells are reserved for the FFI.\r\n\r\n# Instructions\r\nbfgame has 8 instructions. The print(`.`) and input(`,`) operators have different functionalities than those in brainfuck:\r\n\r\n\t. Run the currently selected function\r\n\t, Get the next event from the event queue. If there are no events, this will be return 0.\r\n\t+ Increment the current cell's value by 1\r\n\t- Decrease the current cell's value by 1\r\n\t\u003e Move pointer to next cell\r\n\t\u003c Move pointer to previous cell (won't do anything if in cell #0)\r\n\t[ Jump past the matching ] if the cell under the pointer is 0 \r\n\t] Jump back to the matching [ if the cell under the pointer is nonzero\r\n\r\nAny other characters will be ignored by the interpreter, acting like comments.\r\n\r\n# FFI\r\nTo call external functions, you'll use the first 5 'tape' cells. Here's what \r\neach of them is used for:\r\n\r\n\t0: Module ID - When you select a module, its functions become available\r\n\t1: Function ID to call\r\n\t2: Pointer to beginning of args - This should point to a cell which will be the first one in the functions arguments list. If there are no args, this should be 0.\r\n\t3: Pointer to ending of args - If there are no args, this should be 0. If there is only one arg, it should be the same as #2.\r\n\t4: Returned value - If a function returns a value, it'll go here.\r\n\r\nNow, let's say we want to print the string \"A\" (ASCII codes 65). The function for this is function 1, and it's in the IO module (ID 1). It takes a list of any length and prints it, returning 0.\r\n\r\n\tExample: Printing \"A\"\r\n\r\n\t+     Load the IO module\r\n\t\u003e     Move forward to cell #1\r\n\t+     Add 1 to its value so it's now 1\r\n\t\u003e     Move to cell #2\r\n\t+++++ Add 5 to its value so it points to cell #5 which is where our string will start.\r\n\t\u003e     Move to cell #3\r\n\t+++++ Add 5 to its value which is where our string will end\r\n\t\u003e\u003e\u003e Move to cell #6 our loop counter\r\n\t++++++ Set the loop counter to 6\r\n\t[\r\n\t    \u003c++++++++++ Go back to cell #5 and add 10\r\n\t    \u003e-          Go back to cell #6 and subtract 1\r\n\t]\r\n\t\u003c+++++ Go back to cell #5 and add 5 so it's 65\r\n\t\u003c\u003c\u003c\u003c. Go back to cell #1 and print it to run the function\r\n\r\nEasy, right? :D\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpta2002%2Fbfgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpta2002%2Fbfgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpta2002%2Fbfgame/lists"}