- PHP: 7.4+
- Composer: 1.10+
- Download
- Run
composer install --no-devorcomposer installif you want to run CI tools - Could also be used as dependency if needed
+add 1 to the current register-substract 1 from the current register>move to the next register<move to the prev register.write current register value to output,read current register value from output[go into code if current value is not 0]go to matching opening bracket if current value is not 0
- Write the brainfuck code Be creative or google for examples
$code = '...';- Create the config
$config = new berbeflo\Brainfuck\Config();- Create the interpreter and run it
$interpreter = new berbeflo\Brainfuck\Interpreter($code, $config);
$interpreter->execute();The interpreter can be executed multiple times. It's also possible to change the values of the Config object between the executions. But not the code. For different code, create a different Interpreter instance.
setInputObjectdefine the object that provides the input values; has to implementberbeflo\Brainfuck\Definition\InputsetOutputObjectdefine the object that provides the output values; has to implementberbeflo\Brainfuck\Definition\OutputsetMinRegisterValuethe default min value is0setMaxRegisterValuethe default max value is255setMinPointerValuethe minimum register address; default is0setMaxPointerValuethe maximum register address; default is255setMaximumIterationsprevent endless loops; default is255setWrapOnRegisterOverflowdefaults tofalsesetWrapOnPointerOverflowdefaults tofalsesetAllowUnknownTokensdefaults totrue