03-28-2019, 05:32 PM
(This post was last modified: 03-29-2019, 07:08 AM by qwertyquerty. Edited 6 times in total.)
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:
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:
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:
...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.
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:
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.
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.