From 435751b4dd27fec070ab6ff3457dba4c9d7f8d8d Mon Sep 17 00:00:00 2001 From: Giovani Date: Wed, 16 Jun 2021 20:27:16 -0400 Subject: [PATCH] chore: add readme to the repo --- .gitignore | 1 + LICENSE | 1 + README.md | 44 ++++++++++++++++++++++++++++++++++++++ dopey.py | 3 +-- test.bf => game-of-life.bf | 0 helloworld.bf | 2 -- 6 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 README.md rename test.bf => game-of-life.bf (100%) delete mode 100644 helloworld.bf diff --git a/.gitignore b/.gitignore index b6e4761..55a0c5c 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,4 @@ dmypy.json # Pyre type checker .pyre/ + \ No newline at end of file diff --git a/LICENSE b/LICENSE index c7ac817..859854e 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5777c7d --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# dopey - Another Brainf**k Interpreter + +The dopey brainf\*\*k interpreter was created as a side project to become familiar with Python 3. The goal was to fully implement all the features of brainf\*\*k as defined in this [wiki page](https://en.wikipedia.org/wiki/Brainfuck#Language_design) into dopey. + +## Demo +![gif](https://i.imgur.com/mqjNGzV.gif) + +## Implemetation Limitations + +The dopey is limited to a memory buffer of **30,000** byte cells all initialized to zero. Any attempts to move the pointer past the bounds of the memory buffer will result in an exception being raised. Attempting to print any cell with a value outside of the defined ASCII characters may also result in an exception. + +## Requirements + +Make sure you've installed Python 3. You can download and install Python 3 at [python.org](https://www.python.org/downloads/). + +Verify you have Python 3 installed by running the following: + +```bash +python --version +``` +or in some systems +```bash +python3 --version +``` + +## Running dopey + +Clone the Github repository. From your terminal move to the root of the project and run the following line: + +```bash +python dopey.py my-bf-file.bf +``` + +or in some systems + +```bash +python3 dopey.py my-bf-file.bf +``` + +## Contributing +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. + +## License +[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git a/dopey.py b/dopey.py index f3e7623..b67746c 100644 --- a/dopey.py +++ b/dopey.py @@ -67,7 +67,7 @@ class Operation: @classmethod def output(cls, _) -> None: sys.stdout.write(chr(Memory.buffer[Memory.get_pointer()])) # TODO rollover if too big in ASCII - sys.stdout.flush() + sys.stdout.flush() # TODO possible performance issue @classmethod def input(cls, _) -> None: @@ -127,7 +127,6 @@ def main() -> None: file.close() switch = Operation.get_operations_in_switch() - while program[1] < len(program[0]): operation = program[0][program[1]] program[1] += 1 diff --git a/test.bf b/game-of-life.bf similarity index 100% rename from test.bf rename to game-of-life.bf diff --git a/helloworld.bf b/helloworld.bf deleted file mode 100644 index 929a771..0000000 --- a/helloworld.bf +++ /dev/null @@ -1,2 +0,0 @@ -++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.> ----.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. \ No newline at end of file