ScratchData LogoScratchData
Back to NickyNouse's profile

Brainf

NINickyNouse•Created April 19, 2015
Brainf
55
38
1316 views
View on Scratch

Instructions

Example programs: • Hello world: ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. • Doubles: >++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[<++>-[<++>-[<++>-[<++>-[<-------->>[-]++<-[<++>-]]]]]]<[>+<-]+>>]<<] • Fibonacci: >++++++++++>+>+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<<]>.>>[[-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>>]<<<] • Square numbers: ++++[>+++++<-]>[<+++++>-]+<+[>[>+>+<<-]++>>[<<+>>-]>>>[-]++>[-]+>>>+[[-]++++++>>>]<<<[[<++++++++<++>>-]+<.<[>----<-]<]<<[>>>>>[>>>[-]+++++++++<[>-<-]+++++++++>[-[<->-]+[<<<]]<[>+<-]>]<<-]<<-] Turbo mode is 100% a thing but it's more fun to watch it tick imo. This language manipulates numbers in an array using only 8 characters. The pointer (the black triangle) tells you which byte (list item) you're modifying > Increment the pointer (move up the array) < Decrement the pointer (move down the array) + Increment the byte at the pointer (add 1) - Decrement the byte at the pointer (subtract 1) . Output the byte at the pointer as ASCII. , Input a byte and store it in the byte at the pointer (each time you use this, the next character is used) [ Jump forward past the matching ] if the byte at the pointer is zero. ] Jump backward to the matching [ unless the byte at the pointer is zero. Set input - after clicking the button, you gotta dismiss the current inputbox Clear data - empty the data list but keep the current input

Description

This is an interpreter for Urban Müller's 8-command programming language, whose full name isn't appropriate for Scratch. I wrote a recursive bracket pairer thing for this, feel free to use that for anything with cred. Limitations: • the array is 1-indexed because that's just how Scratch lists work. This has no effect on the programs because they don't actually care which cell number they're on. • the input is case insensitive (I could fix this with the costume trick but it's slow and I'm lazy) • Line breaks aren't a thing so I replaced them with commas Features: • Array extends infinitely to the right or left as needed • When "," is called but there are no more input bytes, the program ends. Cred • ASCII character list from @Griffpatch • Command descriptions by Brian Raiter from www.muppetlabs.com • Hello World program from Wikiipedia • , Doubles, Square Numbers, & Fibonacci by Daniel B Cristofani from www.hevanet.com

Project Details

Project ID57818154
CreatedApril 19, 2015
Last ModifiedApril 20, 2015
SharedApril 20, 2015
Visibilityvisible
CommentsAllowed