16
Your task is make program that do following:
- You should take number. (Positive, negative, fraction is possible input)
- If it is negative, you reverse the quine. and negate that number (Become positive)
- Then you repeat <integer part of the input number> times and print first <floor(fraction part of the input number*length)> from your source program. If it is integer, then the fraction part is zero.
-10% bonus if your program isn't palindrome.
Example
If your program is "ABCDEFG", then
1.
5
ABCDEFGABCDEFGABCDEFGABCDEFGABCDEFG
Explanation
ABCDEFG five times
2.
-2
GFEDCBAGFEDCBA
Explanation
GFEDCBA (reversed ABCDEFG) 2 times
3.
7.5
ABCDEFGABCDEFGABCDEFGABCDEFGABCDEFGABCDEFGABCDEFGABCDEFGABC
Explanation
ABCDEFG 7 times followed by ABC (first 3(floor(0.5*7)=floor(3.5)=3) letter on ABCDEFG)
4.
-0.3
GF
Explanation
GFEDCBA (reversed ABCDEFG) 0 times followed by GF (first 2(floor(0.3*7)=floor(2.1)=2) letter on GFEDCBA(reversed ABCDEFG))
5.
0
<empty>
Explanation:
<empty> here means that your program doesn't output. It is ABCDEFG zero times that is defined as empty string.
Could you please clarify on the instructions? – LegionMammal978 – 2015-11-03T11:12:41.900
1Related. – Martin Ender – 2015-11-03T11:20:45.283
@LegionMammal978 I'm actually bad at expressing thing, but I hope it will make it clearer. – Akangka – 2015-11-03T11:39:47.900
What if a programming language has neither fractions nor negative numbers? – mbomb007 – 2015-11-03T15:20:11.730
2@mbomb007 I guess you can parse the string yourself and handle
-
and.
manually (representing the fraction as positive integers). Or you can turn your attention to the next challenge. ;) (Not every language can participate in every challenge, but as long as the challenge doesn't deliberately rule out arbitrary individual languages, that's completely fine. Just think of all of the audio/image processing or file system challenges.) – Martin Ender – 2015-11-03T15:27:46.557@MartinBüttner Yeah, I'm not doing one of those in BF, lol. – mbomb007 – 2015-11-03T15:34:15.587
1It would have felt more logical to give a 10% bonus to programs which are palindromes – Bassdrop Cumberwubwubwub – 2015-11-03T17:01:23.010
I'm guessing the answer is no, but is a trailing newline allowed? – ThisSuitIsBlackNot – 2015-11-03T22:42:09.373
Is the quine allowed to read its own source code? – Mama Fun Roll – 2015-11-04T04:16:43.190
@ןnɟuɐɯɹɐןoɯ That's called a cheating quine, which is by definition not actually a quine.
– ThisSuitIsBlackNot – 2015-11-04T05:02:42.310@ThisSuitIsBlackNot Nevertheless, it is a quine (albeit a cheating one). My question was if this kind of quine was allowed, because the specs don't address this. – Mama Fun Roll – 2015-11-04T05:04:26.140
@ןnɟuɐɯɹɐןoɯ No, it is not a quine. The term "cheating quine" is a misnomer. A quine is a program that takes no input (including reading from files). A program that reads its own source code is not a quine. – ThisSuitIsBlackNot – 2015-11-04T05:06:05.977
@ןnɟuɐɯɹɐןoɯ Although now that I think about it, a program that prints its own source code in reverse probably isn't a quine, either, technically speaking. :P – ThisSuitIsBlackNot – 2015-11-04T05:09:05.217
@Bas You're right, and I regret it, however, the milk has been spilt. – Akangka – 2015-11-04T09:41:44.227