This challenge is entirely fictional. There is no time limit for this challenge.
My little brother is terrible with computers! He saved up all of his money to buy a new one, and within half an hour the hard drive was wiped and the only software left is a lousy BF interpreter. The worst part of it is, he has a huge Geometry test tomorrow and needs help!
There's no way I'm going to let him touch my machine, so I'm going to need a fast way to write BF programs that solve his problem. He's learning about finding the area of regular polygons, and writing a new BF program for every calculation is a massive task. I need a fast way to generate BF programs! That's where you come in...
Your program or function will receive an integer
2 < N <= 100 which shall represent the number of sides of a regular polygon. You may receive input from function arguments, command line arguments, STDIN, or your language's closest alternative. If necessary, you may additionally require trailing or leading whitespace.
Your program should generate a separate BF program that takes input of a single positive integer
0 < a <= 10^10 that shall represent the length of the apothem of a regular polygon. When run, the BF program should output the area of a polygon with
N sides and an apothem of
a. More specifically:
- Assume that the BF interpreter is set up such that
,takes a number as input and
.outputs a value as a number, not a character. An input of
12does not translate to the characters
'1' '2'in memory, rather the literal number
12. Similarly, when a value of
48is output, it outputs
'48', not the character
- Assume also that each value on the tape of the BF program may contain an infinitely large integer -- the value will never wrap to 0.
- Assume that the tape of the BF spans infinitely to the right, but has no negative indices. The pointer starts at
- My brother is as careless with numbers as he is with computers. As such, the BF code should output the area rounded to the nearest integer.
In a separate and unrelated incident, my brother downloaded so much garbage onto my primary programming machine that I have virtually no hard drive space left. As such, your original program may not exceed 512 bytes.
Your score in this challenge is the length of all BF programs generated by your program for values of
Standard loopholes are disallowed.