Add Brainfuck interpreter#470
Merged
SkeletalDemise merged 6 commits intobee-san:masterfrom Oct 3, 2020
mav8557:brainfuck
Merged
Add Brainfuck interpreter#470SkeletalDemise merged 6 commits intobee-san:masterfrom mav8557:brainfuck
SkeletalDemise merged 6 commits intobee-san:masterfrom
mav8557:brainfuck
Conversation
re-added test_tap_code() removed tap_code test by mistake, should be fixed.
bee-san
reviewed
Oct 3, 2020
Owner
|
@all-contributors please add @mav8557 for code |
Contributor
|
I've put up a pull request to add @mav8557! 🎉 |
Owner
|
This is some great code, excellent self-documenting code 👍 |
SkeletalDemise
suggested changes
Oct 3, 2020
SkeletalDemise
approved these changes
Oct 3, 2020
Owner
|
Hey we're changing from MIT to GPLv3 because some of our projects are licensed with that, do you approve? If you do not approve we will be forced to delete your code and rewrite it 😢 By approving of this change, you are agreeing to re-license the code you wrote under GPLv3. |
Contributor
Author
That's totally fine. Thanks! |
Owner
|
Thank you!!! |
49 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello! Great project idea everyone 👍 and thanks for opening to contributors.
This PR adds a Brainfuck decoder. Brainfuck as a language does support user input (a "key" in this case), but the keyspace in this case is practically infinite. For that reason I'd argue a Brainfuck decoder is appropriate, especially for those CTF problems that simply convert strings to Brainfuck programs.
As a result, this decoder is a trimmed implementation of a full Brainfuck interpreter.
A program that can be "decoded" with this is one that:
(excluding ",") and whitespace.
The last requirement isn't actually a requirement going forward, as some programs might have comments or other text inside of them that can usually be safely ignored. Right now the code does enforce this and return None if there are comments or anything outside of the Brainfuck operators and whitespace, as well as if any of the other requirements are violated.
As requested in #353 the decoder will timeout eventually, at 60 seconds by default. This seemed high to me but if it's alright with you then it's okay.
The Brainfuck specification asks for 30000 memory cells by default, but this seemed excessive for programs that are often not that long. Instead the code starts with 100 cells and appends on any as needed. This can also be changed and is definitely something that I chose arbitrarily as a speed trade-off, so feel free to course correct me on that and we can choose to stick to the spec or something else instead.
Looking to hear what you all think. Thanks for the help with getting started and for maintaining the project!