Author Topic: [Resource] Brain F*ck implementation  (Read 3448 times)

you could just give it the number of stars instead of a string containing the stars
integer limits in torque...
unless I did my math with strings, I don't think that would work


I could convert an integer into binary, then read the binary in (Assuming that the binary doesn't go beyond the string limit)

Testing MGIFOS now!
« Last Edit: September 22, 2013, 01:03:25 PM by MARBLE MAN »

« Last Edit: September 22, 2013, 01:13:04 PM by Electrk »

now do malbolge

;-;
I think I'm done making esoteric interpreters in blockland
you could make a topic to see who can make the best esoteric interpreters (excluding the 1 command languages like Hello)

Noo, MGIFOS :(
Here is your MGIFOS interpreter:

function MGIFOS(%s,%i,%m){return brain_compile(binToBrain(mH(%s)),%i,%m);}
function binToBrain(%s)
{
   %m1=">";%m2="<";%m3="+";%m4="-";%m5=".";%m6=",";%m7="[";%m8="]";
   for(%i=0;%i<strLen(%s);%i+=1)
      %n=%n@%m[getSubStr(%s,%i,1)];
   return %n;
}
function iH(%s){while(%a<strLen(%s)){%i=%i*16+strPos("0123456789ABCDEF",getSubStr(%s,%a,1));%a++;}return %i;}
function brainToMGIFOS(%s)
{
   for(%i=0;%i<strLen(%s);%i++)
   {
      switch$(getSubStr(%s,%i,1))
      {
         case ">":%b="1";
         case "<":%b="2";
         case "+":%b="3";
         case "-":%b="4";
         case ".":%b="5";
         case ",":%b="6";
         case "[":%b="7";
         case "]":%b="8";
      }
      %n=%n@%b;
   }
   return iH(%n);
}

edit1:more compact
edit2:even more compact
edit3:brainToMGIFOS

it requires the compact version of my brain interpreter
it converts the integer to a hex, then hex to brain
MGISO(int stars, string input, int cellnum)

You can now get the number of stars for any brain program:
brainToMGIFOS("brain code");
« Last Edit: September 22, 2013, 01:49:25 PM by MARBLE MAN »