Author Topic: Mindf*ck - A new dialect/extension of Brainf*ck  (Read 3727 times)

0 Members and 1 Guest are viewing this topic.

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Mindf*ck - A new dialect/extension of Brainf*ck
« on: September 20, 2012, 03:41:15 pm »
Cross post from here where I originally announced this

Spoiler For Spoiler:
Ok, so after nearly a year, I actually have something to show for this (Holy crap!)

Introducing Mindf*ck:

A dialect of BF that on top of the original BF command set and principles, adds functionality for using addresses, splitting threads, moving throughout the code (read: subroutines), and the ability to insert values in the code itself easier.

The command list is as follows:
//////////////////////
//BrainF*ck Commands
//////////////////////
>   Shift right
<   Shift left
+   Inc
-   Dec
[   Start while if nonzero
]   End while - break if zero (Jump to address if nonzero)
.   Read char
,   Get char
/////////////////////
//MindF*ck Commands
/////////////////////
#   Get Int
$   Read Int
(   Store address
)   Pop address
{   Copy value to address
}   Retrieve value at address
""   Insert string - overwrites its length
::   Insert binary num   
^   Jump to address
|   Split thread at code address
!   Ends process

The main difference is the addition of a stack used for addresses as well as storing values. Think like what Z80 has. You are also able to move around the code itself to execute sections of code.

"<string>" allows for strings of chars to be inserted into the value array, it will overwrite its length in chars.
:<Number>: this will insert an int expressed in binary at this point in the value array

Another difference is that instead of chars, the array is composed of ints. I did this in order to support jumps using values in the value array.

Things to do:

Fix the split thread command. Weird stuff is happening and I'm not sure why.

More bug testing

Source:

https://sourceforge.net/projects/mindfck/

Edit: I forgot to mention, I still need to write up the full documentation for how each command works and what exactly they read from/effect. Some of the address commands either affect the value array iterator or code iterator, for instance.

This will be the official thread for MF releases, info, and ideas. The idea of the language is to extend BF to where it is feasible to create programs and games within the language, while still providing a fun challenge to the programmer, maintaining esoteric status.

These are the supported commands. I will be updating as new releases become available.

Spoiler For Command List:
//////////////////////
//BrainF*ck Commands
//////////////////////
>   Shift right
<   Shift left
+   Inc
-   Dec
[   Start while if nonzero
]   End while - break if zero (Jump to address if nonzero)
.   Read char
,   Get char
/////////////////////
//MindF*ck Commands
/////////////////////
#   Get Int
$   Read Int
(   Store address
)   Pop address
{   Copy value to address
}   Retrieve value at address
""   Insert string - overwrites its length
::   Insert binary num   
^   Jump to code address
|   Split thread at code address
!   Ends process

///////
//1.1
///////
_   Insert memory address in memory
@   Insert code address in memory
&   Jump to memory address

The largest and most significant addition is that of a stack used to store information as well as addresses. This allows for subroutines to be written as such.

Code: [Select]
:Ret Address: ( /*:param: ( :etc:*/ :Subroutine Address: (^
/*Subroutine*/
/*Extract params using )*//*Subroutine code*/
) // Pop return address
/*Store return values with (*/
( //Store return address
^ // Return

So an example would be a simple addition routine

Code: [Select]
:00011011:(#(#(:00011110:(^)$!)>)[<+>-])<(>(^
This will read two ints and output their sum. Here's the dissection:

Code: [Select]
:00011011:( // Inserts an int and stores it on the stack, this is where we will return to
#(#( // Reads two ints and stores them on the stack
:00011110:( // Inserts an int and stores it on the stack, this is the subroutine address
^)$! // This is the jump and afterwards it displays the first value on our stack and terminates the program
)>)[<+>-])<(>(^ // This is our subroutine. Takes two params, adds them, stores the result, and returns

Todo:

-Write documentation of each instruction and what they do exactly
-Bug test
-Add drawing to the screen/image support (Already know how I'll do this)
-Write IDE for MF
-Prove Turing Completeness (if it has one)
-Write compiler for MF

How to use:

On windows, write your MF code in any text editor, and drag/drop onto the exe.

To use from CMD:

Code: [Select]
<MF_Dir>MindF_ck.exe <File_Dir>
To download, please go to the sourceforge page:

https://sourceforge.net/projects/mindfck/
« Last Edit: September 20, 2012, 03:54:03 pm by HOMER-16 »

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Mindf*ck - A new dialect/extension of Brainf*ck
« Reply #1 on: September 20, 2012, 03:48:16 pm »
Nice :D

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Mindf*ck - A new dialect/extension of Brainf*ck
« Reply #2 on: September 20, 2012, 04:04:41 pm »
Brainf*ck was created as a very limited programming language so it would have the smallest interpreter, it was not created to actually do something useful. I'ts now only used for watching the look on your friends' faces when you show then a brainf*ck program. While your extension does add some instructions which can be usefull to make real programs with it, it is still very hard to read and still so limited that even the simple things would require huge routines, which would make it way to slow to make stuff like graphical games. Also, it still can't read or write from/to files, which is a very basic function that almost every program has.

Also, everyone who programs in brainf*ck probably does it for the challenge, and some may think your extension takes a part of the challenge away.

But anyway, it might be an easyer start for anyone willing to try brainf*ck, so good work.


^The above was not meant tu be rude or anything, but I doubt a bit that it would be very usefull. Brainf*ck is the programming language of a nightmare, and it may be best to keep it like that.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: Mindf*ck - A new dialect/extension of Brainf*ck
« Reply #3 on: September 20, 2012, 04:21:30 pm »
Brainf*ck was created as a very limited programming language so it would have the smallest interpreter, it was not created to actually do something useful. I'ts now only used for watching the look on your friends' faces when you show then a brainf*ck program. While your extension does add some instructions which can be usefull to make real programs with it, it is still very hard to read and still so limited that even the simple things would require huge routines, which would make it way to slow to make stuff like graphical games. Also, it still can't read or write from/to files, which is a very basic function that almost every program has.

Also, everyone who programs in brainf*ck probably does it for the challenge, and some may think your extension takes a part of the challenge away.

But anyway, it might be an easyer start for anyone willing to try brainf*ck, so good work.


^The above was not meant tu be rude or anything, but I doubt a bit that it would be very usefull. Brainf*ck is the programming language of a nightmare, and it may be best to keep it like that.

This interpreter supports vanilla brainf*ck, so anyone who wants to use that, may certainly do so.

I plan on file loading support through use of an IDE, that would "compile" the data into one MF file. If people want though, I could try to see if I can add that kind of support maybe using the /\ characters and a separate memblock just for files. Though, I'd rather not quite have to do that. But it's feasible.

The actual point is not really to be more difficult than BF (if you want difficulty, use BF) I want a language that can feasibly be used to create useful programs while using limited commands. It's kind of something between BF and ASM, perhaps.

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...