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

32 Answers 32

1
2
0
\$\begingroup\$

19, Octave, 196 bytes

Note: I made an edit to the code, to fix an error. The only change was to include the palindrome rule. This avoids a false positive for answer 10.


Most requirements up until now can easily be circumvented using comments and suppressed strings, making it trivial to add answers. I figured I'd make it a bit harder by disallowing some characters instead.

.6;%+->?|"e"|?>-+%;6.
f=@(x)all(ismember('Hi, Retina!',x))&sum(ismember(x,cat(2,33:36,46,91:93,'')))<6&x(2)<60&all((k=x(1:find(x==10,1)-1))==flip(k))
%













































Try it online!

Satisfies:

  1. The first character is a ..
  2. It contains an e.
  3. Its length is even.
  4. Its length is a perfect square.
  5. It contains an a.
  6. It contains a > character.
  7. Contains the exact string ->.
  8. Contains the exact string Hi, Retina!.
  9. The sum of the first two Unicode code points is a multiple of 5.
  10. The 10-th character is a ".
  11. The last non-empty line does not have any duplicate characters.
  12. The first line is a palindrome of length > 5.
  13. The first line is exactly 21 characters long (not including newline).
  14. It contains a ?.
  15. It contains a |.
  16. Contains a +.
  17. It is at least 28 lines long.
  18. The following characters are used five times in total: !"#$.[\] and the codepoint of the second character is less than 60.

For future answers:

  • The first character is a ., and so is the 21st character (palindromic rule).
  • Its length is an even perfect square.
  • Contains the exact sequence ->.
  • Contains the exact string Hi, Retina!.
  • The second character's Unicode code point, mod 5, is 4, and its code point is lower than 60.
  • The 10-th character is a ", and so is the twelfth character (palindromic rule).
  • 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 +.
  • It is at least 28 lines long.
  • The following characters can only be used five times in total: !"#$.[\].
    • Each program is now allowed only the 2 . and 2 " in the first line, and the ! in Hi, Retina!. Those characters cannot be used anywhere else, in addition to no uses of #$[\].
\$\endgroup\$
6
  • \$\begingroup\$ I didn't downvote, but citing OP: This will probably be more fun if you try to maximize your own score rather than "win" the challenge. \$\endgroup\$
    – Uriel
    Commented Mar 20, 2018 at 11:55
  • \$\begingroup\$ I didn't downvote, but maybe the downvoter did so because you validate two things in one answer instead of one. There isn't any rule that disallows this, but I can imagine someone downvoting because of that. (Or because they had an answer planned which isn't possible anymore, although that would be a pretty childish reason to downvote imo..) Because I can't see anything wrong with it, I upvoted to neutralize. \$\endgroup\$ Commented Mar 20, 2018 at 12:03
  • \$\begingroup\$ can you raise the 5 character limit to something higher or exclude . before another answer is due? since first line is palindrome it leaves only 3 dots, which is almost impossible in most OOP verbose langs. also 5 " and `` makes it almost impossible to create multiline strings \$\endgroup\$
    – Uriel
    Commented Mar 20, 2018 at 13:01
  • \$\begingroup\$ The good news is that I know a couple languages that should still work. \$\endgroup\$
    – mbomb007
    Commented Mar 20, 2018 at 15:03
  • \$\begingroup\$ Thanks for noticing, I have fixed it now without affecting the chain. I must have copied the code from the wrong tab (I had similar codes in several tabs for testing purposes). \$\endgroup\$ Commented Mar 21, 2018 at 8: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\$
2
  • 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
    Commented Mar 20, 2018 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\$ Commented Mar 20, 2018 at 10:13
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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