11
1
Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the range 1...99999) and possesses a gadget that produces the required knocks. However, the gadget is a Brainfuck interpreter! So your friend needs to feed it a Brainfuck program, which, obviously, should be as short as possible (the gadget's I/O is slow).
Your task is to help him! Write a program or a subroutine, in any language, that accepts as input a number N
, and outputs a Brainfuck program, which takes no input and outputs a string of printable ASCII characters (excluding the space character - codes in the range 33...126) of length N
.
Example: for input 10
, the output might be
+++++++++++++++++++++++++++++++++..........
(but I am sure it can be shortened!)
Your score will be the sum of lengths of your outputs for the following values of N
(they are random numbers):
55
68
15
28
841
838
522
846
4898
9004
9363
3810
13230
67175
37231
44701
Oh, and you will be transmitting your code (the generator program) to your friend by Twitter. So make sure it's 140 characters or less!
P.S. The Brainfuck language has many variants. Let's assume the tape is infinite in both directions (or "circular and large enough"), and the cells have 32-bit int capacity (finite and able to hold numbers up to 99999). Also, no wrapping: when a cell overflows, the machine self-destructs!
1
"following values of N (they are random numbers)" reminded me of http://xkcd.com/221/
– cirpis – 2015-03-17T09:40:49.343Just for reference, the space character (character code 32) is usually included in the printable ASCII range. It doesn't really make a difference for the challenge since you've defined the range explicitly though. – Martin Ender – 2015-03-17T11:51:46.457
3Can we assume cells in brainfuck to be arbitrary width integers? If not, how and when do they wrap? – orlp – 2015-03-17T14:23:40.200
1It would be nice to assume at least being able to contain 67175 + a few. – orlp – 2015-03-17T14:49:09.410
@anatolyg I realized that later. Sorry. – Esolanging Fruit – 2016-11-28T15:07:44.373