Goal
Do some action (like delete a file, connect to a server, …) that you can not do in standard Brainfuck.
What
As you know, all calculations you can do in almost any programming language you can also do in standard Brainfuck. However, since standard Brainfuck can't do most syscalls, there are many things that are impossible to do in Brainfuck. Your goal is to do anything that is impossible in Brainfuck.
Rules
Do something that is not possible with a valid program in standard Brainfuck. With standard Brainfuck i mean:
- It only uses the 8 Brainfuck instructions (
[]+-<>.,
). - All cells start with the value 0.
- The output/input is not interpreted/generated in a special way to do any other actions (except what standard Unix terminals may do).
- There are no unexpected features in the Brainfuck implementation, accessible from the Brainfuck code.
- Assume that there are no implementations Bugs.
- The implementation may or may not request more memory from the OS when more cells / higher values are used.
- The implementation could have any execution speed.
- The implementation may or may not halt when a negative cell index or a cell index that is out of bounds (in case the implementation has a limited amount of cells) is reached and may or may not generates an error with a message and/or exit with a different exit code.
- The implementation can have any number of bits peer cell (from 1 to virtually infinite).
- The implementation may or may not run on a UNIX terminal, where you can set colours, bold or italic letter, clear the screen and jump with the cursor just by sending special sequences.
Anything on this list counts as impossible with any standard Brainfuck implementation. Write a program that does at least one from the following this list or something else that is impossible in standard Brainfuck:
- Create, delete or move a File**.
- Open a file that wasn't opened before (i.e. not
stdout
,stderr
norstdin
). - Get/display the current time.
- Shutdown, restart, … the system (when your program isn't the only program).
- Change the current working directory.
- Get/display command-line arguments.
- Do anything that requires the internet.
- Fork/start or kill a process (other than the program's own process).
- Get random numbers from a external (i.e. not from a PRNG with a fixed seed nor a seed from the input) source.
- Wait on user input with a timeout.
- Send a signal to a different process.
- Change its own command line.
- Write a specific message to
stdout
AND a specific message tostderr
. (By specific, i mean a message that is completely controlled by the code and not the implementation). - Change the baud rate on a serial port.
- Mount, unmount, format, defragment, eject … a drive/partition.
- Enable/disable a network connection.
- Catch and react to a signal (other than the standard action).
- Play a sound other than the
\a
/Bell-Character. - Open or close a Windows (Except closing the own terminal).
- Getting / display info about the underlining OS or Hardware (except for the size of a Byte)
- …
**It is theoretically possible to write a Brainfuck program that emulates a shell where you can create and delete files within, but that file would only exist in RAM inside the Brainfuck program, so it is not the same.
Things that are, at least theoretically, possible in Brainfuck and don't count:
What | Explanation | Example |
---|---|---|
Do calculations | Brainfuck is turing complete | - |
Show graphics | A Brainfuck program can use coloured text or different Letter to display the pixels of an image. | Mandelbrot, Coloroutput |
Show animations | Outputing multiple images can create an animation | BadApple |
Delay/Wait a short time | Some interpreters have a fixed clock rate and you can calculate a delay based on the number of executed instructions. | - |
Exit with EXIT_SUCCESS or EXIT_FAILURE |
Some interpreters will exit with EXIT_FAILURE when a negative cell is reached. |
Codegolf Answer |
Write to stdout and a generic error message to stderr . |
Brainfuck can write to stdout . Accessing a negative cell index may cause some interpreter do display an error message |
|
Use a certain amount of RAM or request more memory from the OS | Some implementations request more RAM when more cells are used | - |
Read or write from a single already opened file. | On Unix, stdin and stdout can be almost any file, which can be set before the Process starts. This is standard and an expected feature of the OS/shell. |
|
Display the size of a Byte | A Brainfuck program could detect the size of a single cell (which i count as a Byte) and display it | - |
Write to stdout and a standard error message to stderr |
Some implementations write to stdout normally but display a error message when they reach a error condition, such as reaching a cell with negative index |
Online interpreter with separate error Output. |
Shortest code wins.
Example
An ungolfed example in Python:
import datetime
now = datetime.datetime.now()
print(now.strftime("%Y-%m-%d %H:%M:%S"))
/
- Try it online)? \$\endgroup\$stdout
,stderr
or something else) doesn't count. Why: Brainfuck writtes to an output stream, and in most interpreter it is very easy to set what that output is writing to, it is an expected feature of many implementations. However, writing to 2 files (for example,stdout
andstderr
) counts. If you can create better rules, you can make a new and better challenge/question (especially since this question is closed). \$\endgroup\$