Y2K… in 2019?Golf you a quine for great good!Program that creates larger versions of itself...

Can I legally make a real mobile app based on a fictional app from a TV show?

(11 of 11: Meta) What is Pyramid Cult's All-Time Favorite?

Max Order of an Isogeny Class of Rational Elliptic Curves is 8?

How do I explain to a team that the project they will work on for six months will certainly be cancelled?

Shabbat clothing on shabbat chazon

Who are these characters/superheroes in the posters from Chris's room in Family Guy?

The pronunciation of "protester"

Can I call myself an assistant professor without a PhD?

What word can be used to describe a bug in a movie?

Why is there a need to prevent a racist, sexist, or otherwise bigoted vendor from discriminating who they sell to?

Dropdowns & Chevrons for Right to Left languages

Could one become a successful researcher by writing some really good papers while being outside academia?

Acceptable to cut steak before searing?

What does "sardine box" mean?

What is my malfunctioning AI harvesting from humans?

Y2K... in 2019?

Does two puncture wounds mean venomous snake?

Optimal way to extract "positive part" of a multivariate polynomial

How can I iterate this process?

Looking for a new job because of relocation - is it okay to tell the real reason?

Why should we care about syntactic proofs if we can show semantically that statements are true?

Author changing name

In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?

Ordering a word list



Y2K… in 2019?


Golf you a quine for great good!Program that creates larger versions of itself (quine-variant)Quit Whining; Start QuiningMake an interweaving quineWhen will Brexit happen?Period 2 Reversed QuineSlow growing QuineRussian Nesting Quinen-level Ouroboros Quine






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







5












$begingroup$


It's August 10th, 2019, but your task still involves Y2K. Weird, right?



Create a program that, when run, prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original program without a two digit number, it should output the original program, but with 01 appended to it.Run that output to get the OG program with 02 appended, then that to get the program with 03... This chain should continue until 99. That program should output "BREAKING NEWS: WORLD ENDS".



If your program is Y2Kparanoia: yes them:




  1. It should output Y2Kparanoia: yes00

  2. That output should print Y2Kparanoia: yes01

  3. That output should print Y2K paranoia: yes02

  4. Repeat until step 100: this program outputs the doomsday news specified


This is code golf, so the shortest program that can print itself while following these steps wins.










share|improve this question











$endgroup$










  • 3




    $begingroup$
    According to the description the 99th time we run we'll be running 2Kparanoia: yes97 and producing 2Kparanoia: yes98, so shouldn't (4) read Repeat to step 100, but step 101 will output "BREAKING NEWS: WORLD ENDS"? (i.e. 2Kparanoia: yes99 produces the news)
    $endgroup$
    – Jonathan Allan
    7 hours ago




















5












$begingroup$


It's August 10th, 2019, but your task still involves Y2K. Weird, right?



Create a program that, when run, prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original program without a two digit number, it should output the original program, but with 01 appended to it.Run that output to get the OG program with 02 appended, then that to get the program with 03... This chain should continue until 99. That program should output "BREAKING NEWS: WORLD ENDS".



If your program is Y2Kparanoia: yes them:




  1. It should output Y2Kparanoia: yes00

  2. That output should print Y2Kparanoia: yes01

  3. That output should print Y2K paranoia: yes02

  4. Repeat until step 100: this program outputs the doomsday news specified


This is code golf, so the shortest program that can print itself while following these steps wins.










share|improve this question











$endgroup$










  • 3




    $begingroup$
    According to the description the 99th time we run we'll be running 2Kparanoia: yes97 and producing 2Kparanoia: yes98, so shouldn't (4) read Repeat to step 100, but step 101 will output "BREAKING NEWS: WORLD ENDS"? (i.e. 2Kparanoia: yes99 produces the news)
    $endgroup$
    – Jonathan Allan
    7 hours ago
















5












5








5





$begingroup$


It's August 10th, 2019, but your task still involves Y2K. Weird, right?



Create a program that, when run, prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original program without a two digit number, it should output the original program, but with 01 appended to it.Run that output to get the OG program with 02 appended, then that to get the program with 03... This chain should continue until 99. That program should output "BREAKING NEWS: WORLD ENDS".



If your program is Y2Kparanoia: yes them:




  1. It should output Y2Kparanoia: yes00

  2. That output should print Y2Kparanoia: yes01

  3. That output should print Y2K paranoia: yes02

  4. Repeat until step 100: this program outputs the doomsday news specified


This is code golf, so the shortest program that can print itself while following these steps wins.










share|improve this question











$endgroup$




It's August 10th, 2019, but your task still involves Y2K. Weird, right?



Create a program that, when run, prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original program without a two digit number, it should output the original program, but with 01 appended to it.Run that output to get the OG program with 02 appended, then that to get the program with 03... This chain should continue until 99. That program should output "BREAKING NEWS: WORLD ENDS".



If your program is Y2Kparanoia: yes them:




  1. It should output Y2Kparanoia: yes00

  2. That output should print Y2Kparanoia: yes01

  3. That output should print Y2K paranoia: yes02

  4. Repeat until step 100: this program outputs the doomsday news specified


This is code golf, so the shortest program that can print itself while following these steps wins.







code-golf quine






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago







Andrew

















asked 10 hours ago









AndrewAndrew

3981 silver badge14 bronze badges




3981 silver badge14 bronze badges











  • 3




    $begingroup$
    According to the description the 99th time we run we'll be running 2Kparanoia: yes97 and producing 2Kparanoia: yes98, so shouldn't (4) read Repeat to step 100, but step 101 will output "BREAKING NEWS: WORLD ENDS"? (i.e. 2Kparanoia: yes99 produces the news)
    $endgroup$
    – Jonathan Allan
    7 hours ago
















  • 3




    $begingroup$
    According to the description the 99th time we run we'll be running 2Kparanoia: yes97 and producing 2Kparanoia: yes98, so shouldn't (4) read Repeat to step 100, but step 101 will output "BREAKING NEWS: WORLD ENDS"? (i.e. 2Kparanoia: yes99 produces the news)
    $endgroup$
    – Jonathan Allan
    7 hours ago










3




3




$begingroup$
According to the description the 99th time we run we'll be running 2Kparanoia: yes97 and producing 2Kparanoia: yes98, so shouldn't (4) read Repeat to step 100, but step 101 will output "BREAKING NEWS: WORLD ENDS"? (i.e. 2Kparanoia: yes99 produces the news)
$endgroup$
– Jonathan Allan
7 hours ago






$begingroup$
According to the description the 99th time we run we'll be running 2Kparanoia: yes97 and producing 2Kparanoia: yes98, so shouldn't (4) read Repeat to step 100, but step 101 will output "BREAKING NEWS: WORLD ENDS"? (i.e. 2Kparanoia: yes99 produces the news)
$endgroup$
– Jonathan Allan
7 hours ago












5 Answers
5






active

oldest

votes


















4












$begingroup$

Go, 382 366 354 340 305 298 bytes



Won't win but I had fun with the challenge.



package main
import."fmt"
func main(){if n<199{s+="x60,"
Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
var s,n=`package main
import."fmt"
func main(){if n<199{s+="x60,"
Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
var s,n=`,1


Try it on the Go Playground!



Based on a quine. If the variable n is less than 199, then it adds to the string variable n a grave accent (x60), Go's character for multiline strings, followed by a comma ,. It continues by printing the first 147 characters of s (to prevent printing the , because that only occurs at the end) then prints s as a whole, and finally prints 100 if n == 1 and n+1 otherwise. The result is that successive runs change the variable n at the end of the program to 100, 101, etc. If the variable n is 199 or more, then it prints breaking news.






share|improve this answer










New contributor



Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





$endgroup$























    2












    $begingroup$

    Ruby, 158 154 bytes



    EDIT: Saved a pair of parens (and corresponding pair in the data section) by realizing that "BREAKING NEWS: WORLD ENDS" is a perfectly valid format string, and ruby ignores any extraneos parameters.





    END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%{END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%%{%s})%%[q,$s<2?0:$s-99]}
    $s=1%02d})%[q,$s<2?0:$s-99]}
    $s=1


    When starting this I realized that since the number has to go at the very end of the program, and ruby doesn't allow using variables before they are declared, I would have to make code run after the digits somehow. I could've done something like def a(s) ... end;a 1 which would become ...end;a 100, however using ruby's lesser-known END syntax uses fewer bytes. However, the block inside END is in a different scope, so $s must be a global variable.



    Explanation:





    • END{ ... };$s=1: Run block of code just before program terminates; Set global variable $s to 1 (or to 100 - 199 in future iterations)


    • $><<( ... ): $> is a shortcut in ruby for stdout, and << on an IO writes to the IO. The parens are required, otherwise it becomes ($><<$s)>198...


    • $s>198?"BREAKING NEWS: WORLD ENDS":(q=...)%[q,$s<2?0:$s-99]: If I were to break this out into slightly more reasonable code it would be:



      if $s > 198
      "BREAKING NEWS: WORLD ENDS"
      else
      q = ...
      number_to_append = if $s < 2
      0
      else
      $s - 100 + 1
      end
      q % [q, number_to_append]
      end


      The % operator applied to a string is effectively printf, with the LHS being the format string and the RHS being the arguments.



    • %{ ... (q=%%{%s}) ... $s=1%02d}: ruby has an interesting syntax for strings that also allows for pairs of curly brackets to appear within the string without any escaping as long as they are balanced. This is very helpful, as otherwise a similar quine would have to escape the string to put it into itself as a string literal. The two substitutions in the format string are %s for a regular string and %02d for a number right-padded to a size of 2 with the character 0.







    share|improve this answer











    $endgroup$























      1












      $begingroup$


      Haskell, 240 232 218 bytes





      p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"
      n=1


      Try it online!



      Adapted from a quine






      share|improve this answer











      $endgroup$























        1












        $begingroup$


        Perl 6, 122 114 bytes





        my&f={$^a;<print $a-199??"my&f={$^a;<$_>~~.EVAL};f "~($a-1&&$a-99)+100!!"BREAKING NEWS: WORLD ENDS">~~.EVAL};f 1


        Try it online!



        Takes the standard quine format and adds the breaking news string as well as the the function call with the appended number






        share|improve this answer











        $endgroup$























          -2












          $begingroup$

          I have no idea what I'm doing (how to check the size of this, for example), but here's some code that accomplishes the task.



          a=input();print(*list(map(lambda x:f'Y2Kparanoia{x:02}n'if x<100else'BREAKING NEWS: WORLD ENDS',range(int(a),101))))


          Let me know if I have to take this down and adjust it!






          share|improve this answer








          New contributor



          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          $endgroup$











          • 3




            $begingroup$
            Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
            $endgroup$
            – cole
            5 hours ago














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "200"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f189668%2fy2k-in-2019%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4












          $begingroup$

          Go, 382 366 354 340 305 298 bytes



          Won't win but I had fun with the challenge.



          package main
          import."fmt"
          func main(){if n<199{s+="x60,"
          Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
          var s,n=`package main
          import."fmt"
          func main(){if n<199{s+="x60,"
          Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
          var s,n=`,1


          Try it on the Go Playground!



          Based on a quine. If the variable n is less than 199, then it adds to the string variable n a grave accent (x60), Go's character for multiline strings, followed by a comma ,. It continues by printing the first 147 characters of s (to prevent printing the , because that only occurs at the end) then prints s as a whole, and finally prints 100 if n == 1 and n+1 otherwise. The result is that successive runs change the variable n at the end of the program to 100, 101, etc. If the variable n is 199 or more, then it prints breaking news.






          share|improve this answer










          New contributor



          Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          $endgroup$




















            4












            $begingroup$

            Go, 382 366 354 340 305 298 bytes



            Won't win but I had fun with the challenge.



            package main
            import."fmt"
            func main(){if n<199{s+="x60,"
            Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
            var s,n=`package main
            import."fmt"
            func main(){if n<199{s+="x60,"
            Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
            var s,n=`,1


            Try it on the Go Playground!



            Based on a quine. If the variable n is less than 199, then it adds to the string variable n a grave accent (x60), Go's character for multiline strings, followed by a comma ,. It continues by printing the first 147 characters of s (to prevent printing the , because that only occurs at the end) then prints s as a whole, and finally prints 100 if n == 1 and n+1 otherwise. The result is that successive runs change the variable n at the end of the program to 100, 101, etc. If the variable n is 199 or more, then it prints breaking news.






            share|improve this answer










            New contributor



            Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            $endgroup$


















              4












              4








              4





              $begingroup$

              Go, 382 366 354 340 305 298 bytes



              Won't win but I had fun with the challenge.



              package main
              import."fmt"
              func main(){if n<199{s+="x60,"
              Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
              var s,n=`package main
              import."fmt"
              func main(){if n<199{s+="x60,"
              Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
              var s,n=`,1


              Try it on the Go Playground!



              Based on a quine. If the variable n is less than 199, then it adds to the string variable n a grave accent (x60), Go's character for multiline strings, followed by a comma ,. It continues by printing the first 147 characters of s (to prevent printing the , because that only occurs at the end) then prints s as a whole, and finally prints 100 if n == 1 and n+1 otherwise. The result is that successive runs change the variable n at the end of the program to 100, 101, etc. If the variable n is 199 or more, then it prints breaking news.






              share|improve this answer










              New contributor



              Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





              $endgroup$



              Go, 382 366 354 340 305 298 bytes



              Won't win but I had fun with the challenge.



              package main
              import."fmt"
              func main(){if n<199{s+="x60,"
              Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
              var s,n=`package main
              import."fmt"
              func main(){if n<199{s+="x60,"
              Print(s[:147],s,100+(n/100)*(n%100+1))}else{Print("BREAKING NEWS: WORLD ENDS")}}
              var s,n=`,1


              Try it on the Go Playground!



              Based on a quine. If the variable n is less than 199, then it adds to the string variable n a grave accent (x60), Go's character for multiline strings, followed by a comma ,. It continues by printing the first 147 characters of s (to prevent printing the , because that only occurs at the end) then prints s as a whole, and finally prints 100 if n == 1 and n+1 otherwise. The result is that successive runs change the variable n at the end of the program to 100, 101, etc. If the variable n is 199 or more, then it prints breaking news.







              share|improve this answer










              New contributor



              Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.








              share|improve this answer



              share|improve this answer








              edited 3 hours ago





















              New contributor



              Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.








              answered 7 hours ago









              Purple PPurple P

              613 bronze badges




              613 bronze badges




              New contributor



              Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.




              New contributor




              Purple P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






























                  2












                  $begingroup$

                  Ruby, 158 154 bytes



                  EDIT: Saved a pair of parens (and corresponding pair in the data section) by realizing that "BREAKING NEWS: WORLD ENDS" is a perfectly valid format string, and ruby ignores any extraneos parameters.





                  END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%{END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%%{%s})%%[q,$s<2?0:$s-99]}
                  $s=1%02d})%[q,$s<2?0:$s-99]}
                  $s=1


                  When starting this I realized that since the number has to go at the very end of the program, and ruby doesn't allow using variables before they are declared, I would have to make code run after the digits somehow. I could've done something like def a(s) ... end;a 1 which would become ...end;a 100, however using ruby's lesser-known END syntax uses fewer bytes. However, the block inside END is in a different scope, so $s must be a global variable.



                  Explanation:





                  • END{ ... };$s=1: Run block of code just before program terminates; Set global variable $s to 1 (or to 100 - 199 in future iterations)


                  • $><<( ... ): $> is a shortcut in ruby for stdout, and << on an IO writes to the IO. The parens are required, otherwise it becomes ($><<$s)>198...


                  • $s>198?"BREAKING NEWS: WORLD ENDS":(q=...)%[q,$s<2?0:$s-99]: If I were to break this out into slightly more reasonable code it would be:



                    if $s > 198
                    "BREAKING NEWS: WORLD ENDS"
                    else
                    q = ...
                    number_to_append = if $s < 2
                    0
                    else
                    $s - 100 + 1
                    end
                    q % [q, number_to_append]
                    end


                    The % operator applied to a string is effectively printf, with the LHS being the format string and the RHS being the arguments.



                  • %{ ... (q=%%{%s}) ... $s=1%02d}: ruby has an interesting syntax for strings that also allows for pairs of curly brackets to appear within the string without any escaping as long as they are balanced. This is very helpful, as otherwise a similar quine would have to escape the string to put it into itself as a string literal. The two substitutions in the format string are %s for a regular string and %02d for a number right-padded to a size of 2 with the character 0.







                  share|improve this answer











                  $endgroup$




















                    2












                    $begingroup$

                    Ruby, 158 154 bytes



                    EDIT: Saved a pair of parens (and corresponding pair in the data section) by realizing that "BREAKING NEWS: WORLD ENDS" is a perfectly valid format string, and ruby ignores any extraneos parameters.





                    END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%{END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%%{%s})%%[q,$s<2?0:$s-99]}
                    $s=1%02d})%[q,$s<2?0:$s-99]}
                    $s=1


                    When starting this I realized that since the number has to go at the very end of the program, and ruby doesn't allow using variables before they are declared, I would have to make code run after the digits somehow. I could've done something like def a(s) ... end;a 1 which would become ...end;a 100, however using ruby's lesser-known END syntax uses fewer bytes. However, the block inside END is in a different scope, so $s must be a global variable.



                    Explanation:





                    • END{ ... };$s=1: Run block of code just before program terminates; Set global variable $s to 1 (or to 100 - 199 in future iterations)


                    • $><<( ... ): $> is a shortcut in ruby for stdout, and << on an IO writes to the IO. The parens are required, otherwise it becomes ($><<$s)>198...


                    • $s>198?"BREAKING NEWS: WORLD ENDS":(q=...)%[q,$s<2?0:$s-99]: If I were to break this out into slightly more reasonable code it would be:



                      if $s > 198
                      "BREAKING NEWS: WORLD ENDS"
                      else
                      q = ...
                      number_to_append = if $s < 2
                      0
                      else
                      $s - 100 + 1
                      end
                      q % [q, number_to_append]
                      end


                      The % operator applied to a string is effectively printf, with the LHS being the format string and the RHS being the arguments.



                    • %{ ... (q=%%{%s}) ... $s=1%02d}: ruby has an interesting syntax for strings that also allows for pairs of curly brackets to appear within the string without any escaping as long as they are balanced. This is very helpful, as otherwise a similar quine would have to escape the string to put it into itself as a string literal. The two substitutions in the format string are %s for a regular string and %02d for a number right-padded to a size of 2 with the character 0.







                    share|improve this answer











                    $endgroup$


















                      2












                      2








                      2





                      $begingroup$

                      Ruby, 158 154 bytes



                      EDIT: Saved a pair of parens (and corresponding pair in the data section) by realizing that "BREAKING NEWS: WORLD ENDS" is a perfectly valid format string, and ruby ignores any extraneos parameters.





                      END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%{END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%%{%s})%%[q,$s<2?0:$s-99]}
                      $s=1%02d})%[q,$s<2?0:$s-99]}
                      $s=1


                      When starting this I realized that since the number has to go at the very end of the program, and ruby doesn't allow using variables before they are declared, I would have to make code run after the digits somehow. I could've done something like def a(s) ... end;a 1 which would become ...end;a 100, however using ruby's lesser-known END syntax uses fewer bytes. However, the block inside END is in a different scope, so $s must be a global variable.



                      Explanation:





                      • END{ ... };$s=1: Run block of code just before program terminates; Set global variable $s to 1 (or to 100 - 199 in future iterations)


                      • $><<( ... ): $> is a shortcut in ruby for stdout, and << on an IO writes to the IO. The parens are required, otherwise it becomes ($><<$s)>198...


                      • $s>198?"BREAKING NEWS: WORLD ENDS":(q=...)%[q,$s<2?0:$s-99]: If I were to break this out into slightly more reasonable code it would be:



                        if $s > 198
                        "BREAKING NEWS: WORLD ENDS"
                        else
                        q = ...
                        number_to_append = if $s < 2
                        0
                        else
                        $s - 100 + 1
                        end
                        q % [q, number_to_append]
                        end


                        The % operator applied to a string is effectively printf, with the LHS being the format string and the RHS being the arguments.



                      • %{ ... (q=%%{%s}) ... $s=1%02d}: ruby has an interesting syntax for strings that also allows for pairs of curly brackets to appear within the string without any escaping as long as they are balanced. This is very helpful, as otherwise a similar quine would have to escape the string to put it into itself as a string literal. The two substitutions in the format string are %s for a regular string and %02d for a number right-padded to a size of 2 with the character 0.







                      share|improve this answer











                      $endgroup$



                      Ruby, 158 154 bytes



                      EDIT: Saved a pair of parens (and corresponding pair in the data section) by realizing that "BREAKING NEWS: WORLD ENDS" is a perfectly valid format string, and ruby ignores any extraneos parameters.





                      END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%{END{$><<(q=$s>198?"BREAKING NEWS: WORLD ENDS":%%{%s})%%[q,$s<2?0:$s-99]}
                      $s=1%02d})%[q,$s<2?0:$s-99]}
                      $s=1


                      When starting this I realized that since the number has to go at the very end of the program, and ruby doesn't allow using variables before they are declared, I would have to make code run after the digits somehow. I could've done something like def a(s) ... end;a 1 which would become ...end;a 100, however using ruby's lesser-known END syntax uses fewer bytes. However, the block inside END is in a different scope, so $s must be a global variable.



                      Explanation:





                      • END{ ... };$s=1: Run block of code just before program terminates; Set global variable $s to 1 (or to 100 - 199 in future iterations)


                      • $><<( ... ): $> is a shortcut in ruby for stdout, and << on an IO writes to the IO. The parens are required, otherwise it becomes ($><<$s)>198...


                      • $s>198?"BREAKING NEWS: WORLD ENDS":(q=...)%[q,$s<2?0:$s-99]: If I were to break this out into slightly more reasonable code it would be:



                        if $s > 198
                        "BREAKING NEWS: WORLD ENDS"
                        else
                        q = ...
                        number_to_append = if $s < 2
                        0
                        else
                        $s - 100 + 1
                        end
                        q % [q, number_to_append]
                        end


                        The % operator applied to a string is effectively printf, with the LHS being the format string and the RHS being the arguments.



                      • %{ ... (q=%%{%s}) ... $s=1%02d}: ruby has an interesting syntax for strings that also allows for pairs of curly brackets to appear within the string without any escaping as long as they are balanced. This is very helpful, as otherwise a similar quine would have to escape the string to put it into itself as a string literal. The two substitutions in the format string are %s for a regular string and %02d for a number right-padded to a size of 2 with the character 0.








                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 2 hours ago

























                      answered 3 hours ago









                      ShelvacuShelvacu

                      4603 silver badges12 bronze badges




                      4603 silver badges12 bronze badges


























                          1












                          $begingroup$


                          Haskell, 240 232 218 bytes





                          p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"
                          n=1


                          Try it online!



                          Adapted from a quine






                          share|improve this answer











                          $endgroup$




















                            1












                            $begingroup$


                            Haskell, 240 232 218 bytes





                            p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"
                            n=1


                            Try it online!



                            Adapted from a quine






                            share|improve this answer











                            $endgroup$


















                              1












                              1








                              1





                              $begingroup$


                              Haskell, 240 232 218 bytes





                              p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"
                              n=1


                              Try it online!



                              Adapted from a quine






                              share|improve this answer











                              $endgroup$




                              Haskell, 240 232 218 bytes





                              p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"p=putStr;h 1=100;h k=k+1;g _=p$"n="++show(h n);main|n>198=p "BREAKING NEWS: WORLD ENDS"|1>0=p<>print<>g$"
                              n=1


                              Try it online!



                              Adapted from a quine







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 1 hour ago

























                              answered 1 hour ago









                              B. MehtaB. Mehta

                              6232 silver badges9 bronze badges




                              6232 silver badges9 bronze badges


























                                  1












                                  $begingroup$


                                  Perl 6, 122 114 bytes





                                  my&f={$^a;<print $a-199??"my&f={$^a;<$_>~~.EVAL};f "~($a-1&&$a-99)+100!!"BREAKING NEWS: WORLD ENDS">~~.EVAL};f 1


                                  Try it online!



                                  Takes the standard quine format and adds the breaking news string as well as the the function call with the appended number






                                  share|improve this answer











                                  $endgroup$




















                                    1












                                    $begingroup$


                                    Perl 6, 122 114 bytes





                                    my&f={$^a;<print $a-199??"my&f={$^a;<$_>~~.EVAL};f "~($a-1&&$a-99)+100!!"BREAKING NEWS: WORLD ENDS">~~.EVAL};f 1


                                    Try it online!



                                    Takes the standard quine format and adds the breaking news string as well as the the function call with the appended number






                                    share|improve this answer











                                    $endgroup$


















                                      1












                                      1








                                      1





                                      $begingroup$


                                      Perl 6, 122 114 bytes





                                      my&f={$^a;<print $a-199??"my&f={$^a;<$_>~~.EVAL};f "~($a-1&&$a-99)+100!!"BREAKING NEWS: WORLD ENDS">~~.EVAL};f 1


                                      Try it online!



                                      Takes the standard quine format and adds the breaking news string as well as the the function call with the appended number






                                      share|improve this answer











                                      $endgroup$




                                      Perl 6, 122 114 bytes





                                      my&f={$^a;<print $a-199??"my&f={$^a;<$_>~~.EVAL};f "~($a-1&&$a-99)+100!!"BREAKING NEWS: WORLD ENDS">~~.EVAL};f 1


                                      Try it online!



                                      Takes the standard quine format and adds the breaking news string as well as the the function call with the appended number







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 52 mins ago

























                                      answered 1 hour ago









                                      Jo KingJo King

                                      30.4k3 gold badges71 silver badges137 bronze badges




                                      30.4k3 gold badges71 silver badges137 bronze badges


























                                          -2












                                          $begingroup$

                                          I have no idea what I'm doing (how to check the size of this, for example), but here's some code that accomplishes the task.



                                          a=input();print(*list(map(lambda x:f'Y2Kparanoia{x:02}n'if x<100else'BREAKING NEWS: WORLD ENDS',range(int(a),101))))


                                          Let me know if I have to take this down and adjust it!






                                          share|improve this answer








                                          New contributor



                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.





                                          $endgroup$











                                          • 3




                                            $begingroup$
                                            Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
                                            $endgroup$
                                            – cole
                                            5 hours ago
















                                          -2












                                          $begingroup$

                                          I have no idea what I'm doing (how to check the size of this, for example), but here's some code that accomplishes the task.



                                          a=input();print(*list(map(lambda x:f'Y2Kparanoia{x:02}n'if x<100else'BREAKING NEWS: WORLD ENDS',range(int(a),101))))


                                          Let me know if I have to take this down and adjust it!






                                          share|improve this answer








                                          New contributor



                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.





                                          $endgroup$











                                          • 3




                                            $begingroup$
                                            Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
                                            $endgroup$
                                            – cole
                                            5 hours ago














                                          -2












                                          -2








                                          -2





                                          $begingroup$

                                          I have no idea what I'm doing (how to check the size of this, for example), but here's some code that accomplishes the task.



                                          a=input();print(*list(map(lambda x:f'Y2Kparanoia{x:02}n'if x<100else'BREAKING NEWS: WORLD ENDS',range(int(a),101))))


                                          Let me know if I have to take this down and adjust it!






                                          share|improve this answer








                                          New contributor



                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.





                                          $endgroup$



                                          I have no idea what I'm doing (how to check the size of this, for example), but here's some code that accomplishes the task.



                                          a=input();print(*list(map(lambda x:f'Y2Kparanoia{x:02}n'if x<100else'BREAKING NEWS: WORLD ENDS',range(int(a),101))))


                                          Let me know if I have to take this down and adjust it!







                                          share|improve this answer








                                          New contributor



                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.








                                          share|improve this answer



                                          share|improve this answer






                                          New contributor



                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.








                                          answered 5 hours ago









                                          Mark MorettoMark Moretto

                                          971 bronze badge




                                          971 bronze badge




                                          New contributor



                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.




                                          New contributor




                                          Mark Moretto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                          Check out our Code of Conduct.













                                          • 3




                                            $begingroup$
                                            Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
                                            $endgroup$
                                            – cole
                                            5 hours ago














                                          • 3




                                            $begingroup$
                                            Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
                                            $endgroup$
                                            – cole
                                            5 hours ago








                                          3




                                          3




                                          $begingroup$
                                          Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
                                          $endgroup$
                                          – cole
                                          5 hours ago




                                          $begingroup$
                                          Welcome to CCCG! I think your answer doesn’t output its source code with the digits appended. It isn’t immediately obvious from the challenge spec (at least if you aren’t familiar with these formats) that your program should take no input and print itself with 00 appended, then 01 instead of 00 appended, etc, until you get to 99 and then print the Y2K message. Also, I would like to make a plug for tio.run, where you can generate links to run your program online. Enjoy your stay!
                                          $endgroup$
                                          – cole
                                          5 hours ago


















                                          draft saved

                                          draft discarded




















































                                          If this is an answer to a challenge…




                                          • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                          • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                            Explanations of your answer make it more interesting to read and are very much encouraged.


                                          • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                          More generally…




                                          • …Please make sure to answer the question and provide sufficient detail.


                                          • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f189668%2fy2k-in-2019%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

                                          The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

                                          Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...