I will officially announce this as Brainfuck Golf Hole #2 on Monday,
January 7th, possibly with minor clarifications and/or revisions.


Following up from computing the primes, we'll stick with basic
mathematics but add some input.  The second task for Brainfuck Golf is
to implement a Reverse Polish notation (RPN) calculator program
supporting at least addition, subtraction, multiplication, and integer
division of the non-negative integers less than 256.


The valid inputs for this task are finite RPN expressions with:

1) the binary postfix operators +, -, *, and / respectively denoting
addition, subtraction, multiplication, and integer division;

2) integers consistently represented big-endian in exactly one of
binary, octal, decimal, or hexadecimal;

3) adjacent integers separated by whitespace;

4) other adjacent elements optionally separated by whitespace; and

5) no other characters

such that:

1) the input begins with an integer;

2) at no point while scanning the string will as many operators have
been encountered as integers, except when the number of each is 0;

3) the total number of integers in the expression is exactly one
greater than the total number of operators;

4) no input integer, intermediate figure, or result to the expression
is less than 0 or greater than 255; and

5) no operation in the expression would result in division by zero.


A valid entry for this task must, for one of the permitted number
formats (binary, octal, decimal, or hexadecimal) and all valid inputs
using that format:

1) correctly print the result of the expression using the same number
format, followed by a newline;

2) not print anything else;

3) terminate; and

4) never move the memory pointer left from its starting position.

-root

Reply via email to