English Brainfuck CS2D Scripting Interface

11 replies
Goto Page
To the start Previous 1 Next To the start
Up
TheNecro
User
Offline Off
Didn't you too always want to write CS2D scripts in Brainfuck? No? Whatever you can do it anyway!

What is Brainfuck >


I spend weeks(a few hours today) to write an interface that allows loading Brainfuck programs that communicate with lua to give them full control over the scripting environment. Why? For the good of all of humanity of course... and because I was bored.

How does it work? It's a lua script that can be loaded that interprets the Brainfuck programs using an interpreter I wrote yesterday. But that's not all! It keeps track of the output and buffers it. As soon as you write a null character to the output it takes that buffer and executes it using loadstring and thus executes the previous output as lua code. If your output starts with an exclamation point(!) it will read whatever was returned by loadstring into Brainfuck's input.

The input will be modified according to the following rules:
• Numbers will stay as they are and will cause errors if they aren't integer numbers within the range 0-255.
• Booleans will be turned into 1(true) and 0(false).
• Strings will be turned into char codes (as per usual).
• All other types will be turned into strings and then handled like a string.

The Brainfuck programs do one operation every tick (using an always hook).

How do you use it? It comes with a few simple commands.
•
_BF.add_program(program,input,callback)

     Adds a program to be executed to the system.
     program: the Brainfuck code as a string
     input: the starting setup for the input as a string
     callback: function that will be triggered whenever the program puts out a character (can be nil)
•
_BF.dofile(file)

     Adds a program to be executed to the system with empty input and no callback.
     file: the location of the Brainfuck code file

Script and Examples >
The files can be downloaded here: file cs2d Brainfuck+TISfuck CS2D Scripting Interfaces (6)

In case it wasn't clear enough: This is a joke and should not be taken seriously. The execution of Brainfuck scripts is very slow this way and Brainfuck is not a language that should be used seriously anyway.

I hope you like what I did and maybe even learned a thing or two. Have a nice day!
Necro
edited 3×, last 22.08.17 02:44:48 pm
14.08.17 05:07:46 pm
Up
Yates
Reviewer
Offline Off
Now do Lisp.
14.08.17 05:26:51 pm
Up
ohaz
User
Offline Off
-[------->+<]>.-[->++++<]>.++[--->++<]>.---.++.------.--[--->+<]>-.--[->++++<]>-.+[->+++<]>.---.+++++++++++++.-------------.--[--->+<]>-.---[->++++<]>.------------.+.++++++++++.+[---->+<]>+++.-[--->++<]>-.++++++++++.+[---->+<]>+++.++[->+++<]>+.++++++++.------.+++++.-------.
Spoiler >
https://ohaz.engineer - Software Engineering
14.08.17 05:32:21 pm
Up
SQ
Moderator
Offline Off
I'll write a new mod in this. Good luck editing it.
IMG:https://image.ibb.co/dPDZoR/asdas.png
14.08.17 07:20:38 pm
Up
mrc
User
Offline Off
Why dont u use ur knowledge to make good stuffs for the game instead of these useless things.
IMG:https://cs2d.com.br/logo_original.png
16.08.17 03:45:49 pm
Up
TheNecro
User
Offline Off
I'm glad you seem to like it.

I've been working on own more advanced language based on Brainfuck.
TISfuck specification >


And I have modified my Brainfuck interpreter to work on TISfuck instead. PASTEBIN

I might also make a CS2D interface for it and I'll fix the minor bugs my Brainfuck interpreter has.

@user Yates: I get it was meant as a joke but I still looked into LISP but I won't make an interface for that. The reason being that I don't want to write an interpreter for it. There are lua LISP interpreters and even pure lua implementations out there but I think it would be boring just to use one of those.

@user mrc: I make this useless stuff because I think it's a fun way to challenge myself. But because you asked for it I think I can do a custom game mode script. I already have an idea of what it should be like. I won't start creating it right away though.

Code:
.48*61..76.65.20..20.6E.69.63.65.20.64..79.21;

Spoiler >
edited 4×, last 17.08.17 11:19:59 pm
16.08.17 03:56:56 pm
Up
xsiN
User
Offline Off
I've heard about that scripting language, my senpai made it look really difficult to use and I agree with him.

those symbols are truly made to brainfuck people
16.08.17 04:41:26 pm
Up
Yates
Reviewer
Offline Off
@user TheNecro:
Code:
1
2
3
4
5
6
7
8
(DEFUN RIP ()
    "RIP LISP")

(DEFUN LISPTOLUA ()
    nil)

(if (NOT (LISPTOLUA))
    (PRINT (RIP)))


(Lisp (is (a great) programming (language)) and (should be (more (widespread)))
(please (consider) Lisp's (feelings)))
18.08.17 07:59:42 pm
Up
TheNecro
User
Offline Off
I just released the TISfuck Scripting Interface: file cs2d Brainfuck+TISfuck CS2D Scripting Interfaces (6)

@user Yates: It's not that I don't like LISP. It's just that it's far more complex than Brainfuck and TISfuck will ever be. It would be far too much work for what is essentially a joke.
18.08.17 08:47:32 pm
Up
Yates
Reviewer
Offline Off
@user TheNecro: I know I'm just making fun of Lisp leave me be :p
21.08.17 06:22:46 am
Up
omg
User
Offline Off
this has nothing on subleq (the 1 instruction by itself can compute anything)
actually, someone made a (limited) C to subleq program which blows my mind (higher subleq)
will code for food
To the start Previous 1 Next To the start