Forum

> > CS2D > Scripts > Brainfuck CS2D Scripting Interface
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Brainfuck CS2D Scripting Interface

11 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Brainfuck CS2D Scripting Interface

Qb
User Off Offline

Zitieren
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

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
3× editiert, zuletzt 22.08.17 14:44:48

alt Re: Brainfuck CS2D Scripting Interface

ohaz
User Off Offline

Zitieren
-[------->+<]>.-[->++++<]>.++[--->++<]>.---.++.------.--[--->+<]>-.--[->++++<]>-.+[->+++<]>.---.+++++++++++++.-------------.--[--->+<]>-.---[->++++<]>.------------.+.++++++++++.+[---->+<]>+++.-[--->++<]>-.++++++++++.+[---->+<]>+++.++[->+++<]>+.++++++++.------.+++++.-------.
Spoiler >

alt TISfuck

Qb
User Off Offline

Zitieren
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.

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

Spoiler >
4× editiert, zuletzt 17.08.17 23:19:59

alt Re: Brainfuck CS2D Scripting Interface

xsiN
User Off Offline

Zitieren
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

alt Re: Brainfuck CS2D Scripting Interface

Yates
Reviewer Off Offline

Zitieren
@user Qb:
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)))

alt Re: Brainfuck CS2D Scripting Interface

omg
User Off Offline

Zitieren
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)
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht