These programs are designed in brainfuck environment that uses non-wrapping array and non-wrapping cells. The cells are unsigned 8-bit bytes. These programs use only the UNIX new-line (dec 10). These programs are designed to receive 'no change' on EOF unless otherwise mentioned. Because of these rules the programs should work perfectly in every brainfuck implementation as long as the implementation offers a bunch of unsigned 8-bit cells and doesn't return -1 or 256 or such values on EOF.
Feel free to observe and comment the programs, but don't use them anywhere without crediting me. Sorry, I just had to say that. :)
To note; the order of the programs is from oldest to newest (at least it should be), so the newest (and in most cases a bit more complex) programs are located at the bottom of the page.
digitalr.b - This program calculates the digital root of any given non-negative integer and then prints it out along with a new-line. Give the input as digits (0123456789) and use no other characters. The digital root of Pi's first 10000 decimals is 6.
isbn.b - This program tells you if the given International Standard Book Number (ISBN) is valid or invalid. Since I noticed there are hyphens ('-') at different places in ISBN numbers, I decided it might be the best to let the user remove them by him/herself. Use digits. If the checksum character is X, write it in as 'X' or 'x'. You can have list of ISBN numbers as input, separated from each other via a new-line (UNIX).
hello.b - This program is Hello World language interpreter. Hello World is esoteric programming language (obviously a joke one), and it's quite easy to learn. It has only one instruction, 'h', that prints string "Hello World". Use this interpreter to run your HW programs. The interpreter ignores all the other characters, and prints "Hello World" along with a new-line every time there is 'h' in the source file. :)
beer.b - This program sings the "99 bottles of beer on the wall" song. I'll probably make a shorter version when I have more time. This program naturally notices to print "1 bottle" (notice: no plural) and prints the numbers without any unneeded 0-digits (like for example '9' instead of '09').
pgq.b - Simple polyglot quine in brainfuck and C. :) So, you can run this program, a quine, in your brainfuck interpreter as a brainfuck program or compile it as C code and run the executable -- it outputs its source in both of them, exactly the same way (naturally). Next time I'll try to make it shorter as well as add more languages in it. It uses the UNIX new-line, again.
morse.b - This program translates input to (International) Morse code (and doesn't print out a new-line after outputting the Morse code). Write in capitalized letters (A-Z). You can also use digits. The following characters are also ok: . , ? ' ! / ( ) & : ; = - _ " and @. The program prints out seven spaces between the words, although if you have more than one space in a row the amount of spaces won't be correct. The program prints out also one space after each character-translated-to-Morse-code. In case of UNIX new-line the program prints out "separator within message" prosign and when the message is over it prints out "stop (end of message)" prosign. The program doesn't ignore other characters, it will crash or work as not supposed to, in case your input has them. I don't really like this program, but for some reason just keeping it here.
quine.b - This is my shortest quine so far, 933 instructions! My goal was to get the program size below 1000 instructions, and seems I have succeeded. :)
abc.b - This program was my third (and final) entry to calamari's a^n b^n c^n brainfuck programming competition. I got my program size down to 400 instructions, but that wasn't even nearly enough to win, since the winning entry weighted 263 instructions. And after the competition was over the program was optimized even further (read: smaller). I also heard that my algorithm was pretty good. :) I see now some ways that I could have done to get it a few instructions smaller, but I won't modify the program anymore since the competition is over and the size is a nice even number now. :) When you run it, give it only characters 'a', 'b', and 'c' as input, followed by a terminating UNIX new-line. You can also feed it zero abc characters but the new-line is always required. You can give the abc-input in any lenght and in any order. Here's a sample input; "aaabbbccc" (followed by a new-line).
selfsize.b - This program is quine-styled in the sense it is self-referential (and basically exists just to show some fun trick without doing anything 'really useful' (like most of these programs) :)). This program prints out its own byte-size (31) as an integer and then a new-line (dec 10) after that. Getting this kind of program any shorter in non-wrapping cell environment may be impossible.
ptmbsg.b - This is one of the best brainfuck hacks I've written, I think. This program generates and prints out Prouhet-Thue-Morse binary sequence values (along with new-lines). I must warn, this is a real memory-eater! :) The computation time grows fast as well; every next sequence is twice as large as the previous one. First the length is quite small; 1, 2, 4, 8, 16.., but soon the lengths get noticeable; ..8192, 16384, 32768, 65536, 131072.. Many interpreters will soon run out of memory.
kbfi.b - A brainfuck interpreter written in brainfuck! This interpreter can store any value from zero to infinity in its memory cells! This means that I'm emulating infinite cell size on 8-bit cell implementation this is written on. :) This program has been one of the most difficult I've written so far. It's far from perfect, but I haven't just felt like trying to optimize the whole thing (3582 instructions). I may do that later. Give the brainfuck program you want to run, as input. Separate the brainfuck program from actual the input by using '!' character. This interpreter will read brainfuck program until it finds '!' or gets to EOF. As for EOF, this interpreter returns EOF = 0 even if the interpreter you're running this on has EOF = no change. Oh. This program requires a lot memory, and preferably a fast computer to run nicely! ;) This program doesn't do any error checking, so run only syntaxically valid and working programs. If you try to output a cell value larger than 255 it malfunctions (for obvious reason).
bct.b - A Bitwise Cyclic Tag interpreter. First feed it the BCT program data using characters '0' and '1'. Then input an UNIX new-line to indicate that the program data has been given. Then give the initial data the same way, by using '0' and '1' and a new-line to finish input. Then it should run your BCT program (naturally only if both the program data and the initial data are longer than of zero length). The interpreter prints out regularly the current memory state of the BCT program, otherwise it'd be a little difficult to know what is happening in the BCT program.
langton.b - Langton's ant random generator. This outputs 'random' data bytes until you choose to terminate it. The program creates the data by emulating a 16x16 grid of Langton's ant with wrapping borders. The program outputs a byte every 8 steps when 8 bits of data have been collected from the grid squares and formed into a byte. Initially the ant is starting at (0, 0) and is facing right. This program seems to be executing a lot of instructions, and therefore can be a bit slow to execute. It's fairly optimized, though. The idea I got for this months ago, but didn't really get around working on it until now. I got the idea when I found out the Langton's ant and read (and saw) that while its idea is very simple it can result to chaos very quickly, and of that I thought it might be good as some random generator. I've done similar program in C, without the output part, and ran it for more than half a day and the grid didn't return to the initial zero state..
atbash.b - Atbash encryption/decryption program. This program uses the Roman alphabet instead of the Hebrew alphabet, naturally in ASCII. When feeding "atbash" as input you'll get "zgyzhs" as output, and when feeding that as input, you'll get back to "atbash". Atbash is an ancient yet simple substitution cipher.
More coming later, naturally. ;)
Get back to index.