48
5
In this challenge you are to write a program or function, that takes a string as input and outputs one of two possible values. We will call one of these values truthy and one falsy. They do not need to actually be truthy or falsy. For an answer to be valid it must meet four additional criteria
When you pass your program to itself it outputs the truthy value.
If you pass your program as input to any older answer it should output the truthy output (of the program you are passing to).
If you pass any older answer to your answer as input it should output the falsy output (of your program).
There must be an infinite number of strings that evaluate to truthy output in all answers on the challenge (including your new answer).
What this will do is it will slowly build up a chain of answers each of which can determine if other programs in the chain come before or after it.
The goal of this challenge is to build up a list of source restrictions that are applied to the successive answers making each one more challenging than the last.
Example
A chain (written in Haskell) could start:
f _ = True
Since there are no older programs, the criteria do not apply to this answer it need only output one of two possible values, in this case it always outputs True
.
Following this could be the answer:
f x=or$zipWith(==)x$tail x
Which asserts that there is a character twice in a row somewhere in the string. The first answer doesn't have this property while the second does (==
). Thus this is a valid next answer.
Special rules
You may use any language you wish (that has a freely available implementation) as many times as you wish.
If you were the last person to answer you must wait at least 7 days before posting a new answer.
Your program may not read its own source.
Since the 4th rule is exceedingly difficult to verify if cryptographic functions are involved, such functions are disallowed.
Scoring criterion
Each time you add an answer you will get as many points as its place in the chain. For example the 5th answer would gain it's writer 5 points. The goal is to get as many points as you can. The last answer will score its answerer -∞ points. This will probably be more fun if you try to maximize your own score rather than "win" the challenge. I will not be accepting an answer.
Since this is answer-chaining you may want to sort by oldest
Perhaps there should be a community wiki post listing all the new requirements added by the answers. It could possibly also have a TIO link to code verifying that a program satisfies all the requirements. – Steadybox – 2018-03-19T21:04:43.110
@Steadybox The TIO link would be hard to constantly update, no? – totallyhuman – 2018-03-19T21:06:16.800
1@totallyhuman The answerer could update it – Conor O'Brien – 2018-03-19T21:06:31.653
@ConorO'Brien Is there a language everybody knows? :P – totallyhuman – 2018-03-19T21:06:56.670
1Here's a ruby script which does that – Conor O'Brien – 2018-03-19T21:07:26.677
@Arnauld I've gone ahead and added that. Thanks for the suggestion. – Post Rock Garf Hunter – 2018-03-19T21:07:45.543
@Steadybox On second thought it might be better to have a TIO link that is carried through with the answers like the answer chaining polyglot. – Post Rock Garf Hunter – 2018-03-19T21:11:52.627
@user56656 Yes, that might be better. – Steadybox – 2018-03-19T21:13:25.520
+1 for "The last answer will score its answerer -∞ points." Prior to reading that I was a bit worried that someone could 'win' the challenge by making it more or less impossible to add more answers. I hope all the answerers take note of this rule! – Nathaniel – 2018-03-20T06:10:39.833
–1 for (1) the requirement that my answer as input to an older program must return something specific, which requires me to know a language used by someone else; (2) being unclear in your second bullet point ("an older answer") whether every older program or one of my choosing must return its truthy. – msh210 – 2018-03-20T07:28:27.770
@msh210 I've gone ahead and fixed the ambiguity. – Post Rock Garf Hunter – 2018-03-20T13:06:33.290
1@msh210 You shouldn't need to know much of anything about other people's languages. So long as they have been courteous enough to provide an easy way to run their program, all you need to do is paste your program into their program's input and run it. Their program run on your program should output the same thing as their program run on itself. – 0 ' – 2018-03-21T06:40:18.107
@totallyhuman I'm pretty sure Python is the most popular language on the site. – mbomb007 – 2018-03-21T14:22:49.777
1@user56656 Can you please address the issue of what cryptographic functions are allowed? See #31. – mbomb007 – 2018-03-26T14:10:01.057
@mbomb007 Since people seem to be in support of disallowing it I have disallowed it. – Post Rock Garf Hunter – 2018-03-27T04:26:08.033
What if someone post a length lowerbound? It desn't block the chain, but make it hard to test – l4m2 – 2018-04-01T00:13:14.927
@l4m2 A length lowerbound is consistent with the rules so it is ok – Post Rock Garf Hunter – 2018-04-01T00:42:26.757