# Mandoline quine

Write a quine... from which every other character can be removed it still be a valid quine. You can specify whether to start removing characters at the first or second character.

Scoring criteria (add bonuses/penatly percentages together for total percentage):

• Answers must be at least 4 characters long
• Program must contain at least one alphabetical character in its source, so for example, 12345!@#$%^&*() is disqualified • +750% if the language used is not Turing-complete (I'm looking at you, HTML!) • -15% if the solution does not read its source from anywhere in any form • -20% if you can also keep only every 5th character and still form a quine The score is measured by the number of characters in the first program. Example (not real programs): If 123456789abcdef and 13579bdf are both quines, the score is 15. Additionally, if 159d is also a quine, then the final score is 12. This is code-golf, so lowest score wins. • @hosch250 The original program wouldn't be a quine because it wouldn't print those whitespaces. Same goes for unnecessary comments. – Jwosty Mar 7 '14 at 5:26 • Yeah, I have never programed a quine before, and have no idea how to do it without reading the source code in C++. I have seen them in C++ before though! – user10766 Mar 7 '14 at 5:37 • You state: "-20% if you can also remove every 4 characters and still form a quine". But technically this is not what happens in your example. You mean you can do it a second time? – mmumboss Mar 7 '14 at 8:17 • Are the bonuses additive or multiplicative? That is, if my program is 10 chars long and qualifies for both the -15% bonus and the -20% bonus, will its score be 10 * (1 - 0.15 - 0.2) = 6.5 or 10 * (1 - 0.15) * (1 - 0.2) = 6.8? I assumed the latter, but an explicit clarification would be nice. – Ilmari Karonen Mar 7 '14 at 10:26 • Wouldn't this be a Mandoline quine, not a Guillotine? Guillotines make one clean, generally fatal, cut and the head rolls away. Mandolines make with the many evenly spaced slices. :) – Jonathan Van Matre Mar 7 '14 at 21:45 ## 10 Answers ## PHP, 4 chars − 15% − 20% = 2.72 2.6 points ABCD Yes, PHP is a Turing-complete language. Nobody said I have to use any of its actual programming features. ;-) Edit: Changed the score based on the clarification that bonuses are additive, not multiplicative. • This works in ASP, possibly. – Ismael Miguel Mar 7 '14 at 14:03 • @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ I give up. :P – Jwosty Mar 8 '14 at 4:35 • Actually, use of PHP's actual programming features is discouraged. – Rhymoid Mar 8 '14 at 18:21 • This is not a proper quine. Still a good answer, though – MilkyWay90 Apr 6 '19 at 18:21 ## TI BASIC 4 - 35% = 2.6 I might understand them wrong, but I think I am also eligible for the -15% and the -20% bonusses, meaning I have the lowest possible score. I can write the program: 123i which will output 123i where i is of course the imaginary unit. When you remove the 1st and the 3rd character all that remains is 2i which outputs 2i • Not quite... '12i' will output '12i' and '2' will output '2' for a minimum score of 1.95. – intx13 Mar 7 '14 at 11:33 • Actually, '2i' scores 1.3, and if the empty program is considered a quine, 'i' scores 0.65. – intx13 Mar 7 '14 at 11:36 • @intx13: "Answers must be at least 4 characters long." – Ilmari Karonen Mar 7 '14 at 14:02 • Ah, I missed that! – intx13 Mar 7 '14 at 18:14 • Beat me to it ;) – Timtech Mar 8 '14 at 0:40 # Python - 95 Great challenge. I thought this was pretty clever, and actually a legit solution! 00;"#";print(open(__file__).read()) 0#;XpXrXiXnXtX(XoXpXeXnX(X_X_XfXiXlXeX_X_X)X.XrXeXaXdX(X)X) • Nice! Note this technically doesn't work as-is since you end up deleting the newline when making the alternate quine. requires a tad bit of tweaking IOW – Claudiu Mar 7 '14 at 5:44 • @Claudiu Well I guess it depends on whether OP considers newline a character. If so, you can just add a newline between each line. 96 chars – qwr Mar 7 '14 at 5:47 • Of course a newline is a character... – mbomb007 Dec 13 '16 at 21:28 ## Golfscript, 5 points {hai} is a function that, when executed, will run the (non-existing) function hai. It's not executed, however, but rather printed when the program ends - including the outer brackets. Removing each other character yields: {a} Lame, I know :-) • I believe you qualify for both bonuses, too: your program does not read its own source code, and {} is a quine too. – Ilmari Karonen Mar 7 '14 at 10:21 • @IlmariKaronen it's hard to tell what counts as reading own source code. Does unevaluating functions count? Does evaluating strings count? As for the other bonus - maybe it's just badly worded, but I read "remove every four characters" as "keep every fifth character", which would leave me with one bracket only (though {ab0} qualifies if 0 can be the one that's kept) – John Dvorak Mar 7 '14 at 10:40 • It's indeed badly worded, but the example suggests it means "keep every fourth character". Anyway, as you note, {ab0} qualifies either way. – Ilmari Karonen Mar 7 '14 at 10:44 • It seems {hi} also works, will be shorter (4 chars), and will also qualify for all bonuses. (Seems the script {i evaluates to {i for some reason...) – Claudiu Mar 7 '14 at 16:59 • – John Dvorak Mar 7 '14 at 19:02 ## HQ9+ - 4 * 7.5 * 0.8 = 24 points Q+++ Still a quine with every second character: Q+ ...and every fifth: Q Sorry, I couldn't resist. :) # HTML/Markdown, 4*7.5 = 30 HHHH I admit this is lame, but it doesn't really go against any rule in the question. Except that HTML/Markdown may not be considered a real programming language. • I suppose I didn't specify that programs that can't be split any smaller aren't valid. Revising challenge... – Jwosty Mar 7 '14 at 5:38 • @Jwosty: then "HHHH" in HTML would win. Note 5555 doesn't work because it has no alphabetic character – Claudiu Mar 7 '14 at 5:42 • You need an alphabetic character. – qwr Mar 7 '14 at 5:43 • @qwr: Forgot that when looking at GolfScript. Removed. – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Mar 7 '14 at 5:44 • Hmm... I suppose that this valid :P – Jwosty Mar 7 '14 at 5:50 # !/bin/sh I liked qwr's solution so much, I shamelessly made a port for POSIX shell. Please don't save it into a filename containing spaces. : '#';cat$0

#c a t   $0 Start removing at character number 1, and count newlines as characters. The second quine is of course: #;a 0 cat$0

# Bash, 23

Newline is a character!

Some messy comment work, so that when every other character starting from the first is removed, the comment becomes code and the code becomes a comment:

#cRaRtR R$R0R R# cat$0

After every other character (including the new line) is removed:

cat $0 #ct$
• it's not a quine if it reads its own source though. – daniero Apr 13 '14 at 14:58
• @daniero "-15% if the solution does not read its source from anywhere in any form" implies that you are allowed to read the program's source (but you don't get the bonus) – user16402 Apr 13 '14 at 15:39
• @daniero oh i looked on wikipedia I suppose it is cheating... but it's code-golf – user16402 Apr 13 '14 at 15:44
• I always upvote cats! – Antonio Ragagnin Apr 13 '14 at 18:29

## Brainf**k, 37 - 15% = 31.45

Abusing the Portable Brainfuck Interpreter

+A[B-C<D+E]F-GÿH<I<J<K<L<M<N<O[P.Q>R]

Start removing from the second character.

• When i run this I get B-C<D+E]F-GÿH<I<J<K<L<M<N<O[P.Q>R] as output so it's lacknig some characters. – Sylwester Mar 8 '14 at 10:57
• Is it Brainfuck, or a particular dialect of Brainfuck that only works on one interpreter? – user253751 Mar 8 '14 at 10:57
• @immibis It's regular (those capital letters can be spaces or symbols or anything). However, you must use the portable interpreter linked from the answer. – Timtech Mar 8 '14 at 12:28
• The first part goes left until it finds the ÿ and the linked interpreter happens to store the code 5000 bytes before the start of the data tape. That's hardly portable Brainfuck. – user253751 Mar 8 '14 at 12:40

# HQ9+T, - 4 * 0.8 = 3.2 points

qqqq

It's a valid quine (ish) and a quine every second and fifth char. I couldn't resist . . . .