Posts Tagged: esoteric languages


4
Jun 07

Improving bfsim-js

Last month, I worked on a little project bfsim-js, a portable graphical brainfuck interpreter, not foreseeing that some people would actually make suggestions and request for changes. Maybe because, as someone commented, I am star-struck, I have decided to further develop bfsim-js.

Watch out for updates!


18
May 07

brainf*cktorial

Long overdue, messy brainfucktorial:

%% TODO
%% - Be able to accept multiple-digit input
%% - Accommodate very large numbers for input
%%   and output
%% - Print result in ASCII, base 10

%% Initialize bytes in R0; R1; R2; R3; R4; R5
%% (End: R0)
>++++++>>+>+>+<<<<<

%% Put byte n in R0 (End: R0)
,

%% Subtract 48 from byte in R0 (End: R0)
>[<-------->-]<

[ %% While byte in R0
    %% Decrement byte in R0, copy to R2
    %% (End: R2)
    -[->+>+<<]
    >[-<+>]>

    [- %% While byte in R2
        %% Add byte in R4 to byte in R5 zeroing
        %% R4 (End: R4)
        >>[->+<]

        %% Copy byte in R3 to R4 (End: R1)
        <[->+<<<+>>]
        <<[->>+<<]
    >]

    %% Zero R3 and R4 (End: R4)
    >[-]>[-]

    %% Copy byte in R5 to R4 and R3 (End: R1)
    >[-<+<+<<+>>>>]
    <<<<[->>>>+<<<<]
<]

%% Byte in current register is factorial(n)
>>>>>

Heh, talk about inefficiency.


17
May 07

Graphical brainfuck interpreter

(EDIT: Correction in the interpreter.)

Around half a year ago, I realized I wanted to write factorial in brainfuck, partly because I was bored and wanted a bit of a challenge, and also partly because I could interestingly call the code brainf*cktorial. It turned out, however, that I was not restless enough for code that used tape that my mental registers could not accommodate. At that time, I did not have a pen and paper, nor a computer, and it occurred to me that I wanted a graphical brainfuck interpreter. I finally wrote one this week.

The graphical brainfuck interpreter can be accessed here. JavaScript and Document Object Model (DOM) made development so much easier. It is pretty cool, so check it out.