Thread Rating:
  • 6 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introducing: CHEMFARD
#1
You know that intimidating looking machine in chemistry known as the "ChemiCompiler"? It allows you to program in recipes for chemicals by using a sequence of mixing steps as well as heating/cooling. The problem is, the programming language is known as "ChemFuck" which is an implementation of the language "BrainFuck" with a few additions. You can read more about those changes here: https://wiki.ss13.co/ChemiCompiler

The code generally looks something like this:

Code:
+}++)--'@+}+)--'@}++)-'@}+)-'@-}++)'@-}+)'@--}++)+'@--}+)+'@>+}<-)++'@>+}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>--}++)<+'@>-}+)<'@>}>)<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'$

Pretty spooky. But, NOT ANYMORE! Introducing CHEMFARD!!!1! The easy to write programming language that compiles directly into ChemFuck! Here is an example of a piece of ChemFard code:

Code:
SET tea 1
SET tea_per_person 10
SET tea_temperature 350
SET current_slot 2

REPEAT 9
   MOVE tea current_slot tea_per_person
   HEAT current_slot tea_temperature
   INC current_slot 1
END

If you put a beaker with at least 90 units of tea in slot one, and put beakers in all 9 other slots. It will fill them each with 10 units of tea, and heat them all up to the perfect-for-tea 350k. It all compiles into this:

Code:
+}+)++++++++'@>++}>)<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'$>-}++)+++++++'@>+++}>)<<<'$>>--}+++)<'@>}>)<<<'$>>>+}<+)<'@>}>-)<<<'$>>>+}<+)<'@>}>-)<<<'$>>>+}<+)<'@>}>-)<<<'$>>>+}<+)<'@>}>-)<<<'$>>>+}<+)<'@-}>>-)<<<'$>>>+}<+)'@}>-)<<<'$>>>})'

...which can be copy pasted directly into the ChemiCompiler.

This code here will make CLF3 assuming you put chlorine into slot one and fluorine into slot two.

Code:
SET chlorine 1
SET fluorine 2
SET clf3 3
MOVE chlorine clf3 25
MOVE fluorine clf3 75
HEAT clf3 450

But I'm not gonna show you the compiled version. Why not? BECAUSE YOU CAN COMPILE IT YOURSELF!



DOWNLOAD fard.exe HERE

Alternatively if you're not into downloading sketchy exe files, here is the python file: DOWNLOAD fard.py HERE somepatat said I had to include this. You'll need to install >=Python 3 to run it though.

Command Line Usage:
 
Code:
fard.exe [filename]



The code is pretty easy to write and to understand, but here is a documentation:

SET var val
Sets a compiler variable to a certain integer-only value. You can use these variables later in your code. You can also set sx tx and ax directly, but you would have no reason to really ever do this, since the compiler handles the setting of those itself when you do other commands that require them.

INC var val
Increments the variable supplied by the value supplied. Variable must have already been created with SET

MOVE source destination amount
Moves amount units of chemicals from one slot to another. Slots are input as a number between 1 and 10. This will take a while for the chemicompiler to do if you are trying to move a lot of of units at once.

HEAT slot amount
Heats a slot to amount kelvin. WARNING: This takes a very long time for the chemicompiler to do, simply because it is slow at heating things.

REPEAT n
Repeats the code within the repeat n times. REPEAT commands must be followed by an END later on. If there is no END then the repeat will be ignored. When an END is reached, the code jumps back to the beginning of the REPEAT unless it has already iterated n time, in which it will ignore the END and move on to the rest of the code. You may nest REPEAT commands. Indentation of the content inside of a REPEAT is optional, but it makes it look much much better.

Any line that does not start with one of those commands is completely ignored, so you may comment your code. Remember that the ChemiCompiler is not the fastest machine in the world, and will not instantly run your code. However, it will give status noises upon certain events, which you can read about on the wiki page linked above. Fard will try and optimize your code and make it as short as possible, and friendly to the compiler.


Lastly: I would love to see what you all make with this, so feel free to reply some recipes you make.
Reply
#2
BLACK POWDER

Code:
SET sulfur 1
SET saltpetre 2
SET ash 3
SET salt 4

put in 100u sulfur and saltpetre, and 50u of ash and salt into the reservoirs listed above

SET charcoal 5

MOVE ash charcoal 50
MOVE salt charcoal 50
HEAT charcoal 380

SET output_slot 6
REPEAT 3
 MOVE sulfur output_slot 33
 MOVE charcoal output_slot 33
 MOVE saltpetre output_slot 33
 INC output_slot 1
END
Reply
#3
This is neat, thanks for sharing.
Reply
#4
This is amazing. I was thinking about making a chemi compiler code for one of my mixes, but ChemFuck is fucking awful. Thanks for this!
Reply
#5
Yeah while this looks amazing the exe link is broke.
Reply
#6
(03-29-2019, 04:25 AM)The Gorog Wrote: This is amazing. I was thinking about making a chemi compiler code for one of my mixes, but ChemFuck is fucking awful. Thanks for this!

The download link for the Executable just links to N/A.

(03-29-2019, 05:18 AM)HydroFloric Wrote: Yeah while this looks amazing the exe link is broke.


The EXE link has been fixed

Also if you people feel there should be any additions or changes, say so
Reply
#7
(03-29-2019, 07:09 AM)qwertyquerty Wrote: Also if you people feel there should be any additions or changes, say so

What about being able to just drag&drop the file onto the executable?
Just tried looking it up, it seems like it needs a regitry key entered, which could be done by adding a .reg file to the download.
Maybe theres another way that doesnt need something as shady as that. 
I know that Java and I believe C# have set arguments that would contain the path of a drag&dropped file.
Reply
#8
(03-29-2019, 11:13 AM)The Gorog Wrote:
(03-29-2019, 07:09 AM)qwertyquerty Wrote: Also if you people feel there should be any additions or changes, say so

What about being able to just drag&drop the file onto the executable?
Just tried looking it up, it seems like it needs a regitry key entered, which could be done by adding a .reg file to the download.
Maybe theres another way that doesnt need something as shady as that. 
I know that Java and I believe C# have set arguments that would contain the path of a drag&dropped file.

I'm pretty sure you already can do that, the console just instantly closes when it's done compiling.
Reply
#9
hm yeah cant copy it out then. you would have to wait for a manual input then.
Reply
#10
(03-29-2019, 11:39 AM)The Gorog Wrote: hm yeah cant copy it out then. you would have to wait for a manual input then.

I would just use it via CMD if I were you.
Reply
#11
I'm loving chemfard, but last I used it, it didn't seem to support outputs of 11~13, the chem/vial/dump outputs. Is this an easy fix on your end?
Reply
#12
These seem like new features that weren't in the game before. I might open source this project so other people can keep maintaining it.

Open source, latest release has those changes.

https://github.com/qwertyquerty/chemfard/tree/master
Reply
#13
I've tried both droppbox exe and version 2 exe from github and exe generated from build.bat. Also installed latest pyton for windows. Well when I try to open one of the exe files or pyton files it will close instantly. Atm no antivirus installed on my pc besides windows defender which I've alloved the file. Sometimes exe hangs a secound and reads out Please specify a file to compile. How can I get this work I would really like to create some stuff in chemcompiler but I'm stuck
Reply
#14
Put your code in a file and then specify that file as a parameter when executing chemfard.

Say you have both your fard.exe and a file named 'code.txt' in the same folder. On windows 10 you could shift-right-click into the folder and press 'Open PowerShell Window Here' to open a command line in that folder.
Then you could write '.\fard.exe code.txt' to execute chemfard for that codefile.
Reply
#15
This is really cool and useful since I don't want to bother learning about hexadecimal stuff and brainfuck, but I've seen some people use the ChemiCompiler to make glass vials and etc, but there seems to be no command for that. Could you add more functions to the compiler? Thanks, this compiler has been really useful so far, and I made a code to mass produce methamphetamine to fill up the cogmap 1's pool with.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)