#BrainCubed
You are the proud maintainer of one of the smartest robots in the world. Well, it used to be. Now its speakers and microphones have been broken and the darn thing only seems to read Brainfuck. To make matters worse, it would appear most of its RAM... disappeared? This will be tough to explain to the boss. No matter. It seems to have figured out how to draw on a whiteboard to supplement its now-shoddy memory, and you have bigger problems on your hands.
You need to know how to fit things in cubes.
##The Task
Lately, your biggest problems (aside from the embarrassing conversation with your boss later) have to do with volume. Cubing things is hard. That's why you'll get the robot to do it for you! Your goal in this challenge is to write a Brainfuck program that computes the cube of a given number. However, the robot's whiteboard isn't very big. The less memory your Brainfuck program requires, the better.
##Input
You will receive a single integer as input, x.
xcan be in any numerical base -- decimal, binary, hexadecimal, pi, whatever.You may assume that
xis in the range0 <= x <= 255
##Output
Your Brainfuck program must output the value of
x^3in the same base that input was received in.The program must terminate, and should not print anything except for its numerical output.
##Rules and Scoring
Your score in this challenge is defined in the following manner: Let the tape of the Brainfuck memory be described as having a 0th element at the left-most position, and then with potentially infinite cells to the right, indexed by increasing integers n.
Let N(x) denote the right-most (highest n) cell that the program ever sends the tape pointer to (not necessarily modified) for a given input x. Your score for this challenge is then sum (x = 0, 1, 2, ... 100) N(x)
In order to verify score, you may use [this] (soon) modified interpreter.
- Your program must be written entirely in Brainfuck.
- Assume the highest value a cell can hold is
255before wrapping to0, and that moving left off of the tape will cause the robot to suddenly and violently crash. - Your program should not exceed 10k bytes, nor should it take more than 10 minutes to compute
x^3for anyx <= 255on a relatively modern machine. - Standard loopholes are disallowed.
code-challengebrainfuckoptimizationarithmetic
###SANDBOX NOTES
What do you think of BF memory-optimization as a basis for a challenge?
I chose cubing x as a challenge that is not so trivial as to allow for different approaches, but still within the grasp of BF (if different bases are allowed). Any other ideas?