48
\$\begingroup\$

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

Try it online!

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 you may want to sort by oldest

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Steadybox Mar 19 '18 at 21:04
  • 1
    \$\begingroup\$ @totallyhuman The answerer could update it \$\endgroup\$ – Conor O'Brien Mar 19 '18 at 21:06
  • 1
    \$\begingroup\$ Here's a ruby script which does that \$\endgroup\$ – Conor O'Brien Mar 19 '18 at 21:07
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ – 0 ' Mar 21 '18 at 6:40
  • 1
    \$\begingroup\$ @user56656 Can you please address the issue of what cryptographic functions are allowed? See #31. \$\endgroup\$ – mbomb007 Mar 26 '18 at 14:10

31 Answers 31

0
\$\begingroup\$

17, Whitespace, 100 bytes

.|?|?|?|?"+"?|?|?|?|.
Hi, Retina!-> 















 abcdefgh

I guess the perfect language for this challenge, and I might post more when the chain has progressed.

Try it online.

Outputs 1 if the input contains a +, or nothing otherwise.

I created a script to check all the characters the previous answers didn't contain yet, and + was the first one, so I've used that as a validation for my answer. My program also returns true in the TIO-links of all previous answers (except in X86 Assembly (gcc 6.3) where I got an error.., although my answer does satisfy to all the rules of the previous answers).

Satisfies / For future answers:

  • The first and twenty-first characters are ..
  • Its length is even and a perfect square.
  • Contains the exact string ->.
  • Contains the exact string Hi, Retina!.
  • The second character's Unicode code point, mod 5, is 4.
  • The tenth and twelveth characters are ".
  • The last non-empty line does not have any duplicate characters.
  • The first line is a palindrome of length 21.
  • It contains a ?.
  • It contains a |.
  • It contains a +.

Explanation:

In Whitespace, every character except for spaces, tabs and new-lines are ignored. Here is the base program with just the spaces, tabs and new-lines:

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

[N
S S N
_Label_LOOP][S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve][S S S T  S S S S S N
_Push_43][T S S T   _Subtract][N
T   S S N
_Jump_to_Label_TRUE_if_0][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_TRUE][S S S T N
_Push_1][T  N
S T _Print_as_integer][N
S N
S _Jump_to_Label_EXIT]
\$\endgroup\$
  • 1
    \$\begingroup\$ According to the rules, If you pass any older answer to your answer as input it should output the falsy output (of your program) – This fails on the Pyth, Whispers, Retina, Somme, Python, Quarterstaff, X86 Assembly, Perl and Javascript answers. \$\endgroup\$ – Mr. Xcoder Mar 20 '18 at 10:00
  • \$\begingroup\$ @Mr.Xcoder Should be fixed now. None of the other answers contains a +, so I've used that instead of space. \$\endgroup\$ – Kevin Cruijssen Mar 20 '18 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.