Play Zip, Zap, ZopGenerate keyboard shortcuts for a menuLet's play countdown!Stretching WordsWrite a program...

Play Zip, Zap, Zop

What is the difference between "...", '...', $'...', and $"..." quotes?

Is there a verb that means to inject with poison?

How to not let the Identify spell spoil everything?

A Missing Symbol for This Logo

Why is Agricola named as such?

Most demanding German Newspapers

Changing the laptop's CPU. Should I reinstall Linux?

Do authors have to be politically correct in article-writing?

Why avoid shared user accounts?

Cryptic with some cross words

Why does magnet wire need to be insulated?

How does one write from a minority culture? A question on cultural references

How to visualize the Riemann-Roch theorem from complex analysis or geometric topology considerations?

What will happen if Parliament votes "no" on each of the Brexit-related votes to be held on the 12th, 13th and 14th of March?

Can the "Friends" spell be used without making the target hostile?

Can 5 Aarakocra PCs summon an Air Elemental?

Has any human ever had the choice to leave Earth permanently?

Why did Luke use his left hand to shoot?

Treasure Hunt Riddle

The effect of fishing on total land area needed to feed an island settlement

Why does PHOTOREC keep finding files?

How do I prevent a homebrew Grappling Hook feature from trivializing Tomb of Annihilation?

What game did these black and yellow dice come from?



Play Zip, Zap, Zop


Generate keyboard shortcuts for a menuLet's play countdown!Stretching WordsWrite a program that finds the most occurring paired letter in a stringLet's play Hangman?Play the word chainFind the shortest pangrams from a word listScore a Game of BoggleCount Consecutive CharactersHelloellolloloo Worldorldrldldd













7












$begingroup$


There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever.



Your task is to create a program that gives the next word in sequence given an input word. (Zip --> Zap --> Zop --> Zip) Since there's a lot of different ways to say these three words and flairs that can be added to them, your program should imitate case and letter duplication and carry suffixes.



To elaborate, your input will be one or more Zs, then one or more Is, As, or Os (all the same letter), then one or more Ps, (all letters up to this point may be in mixed case) followed by some arbitrary suffix (which may be empty). You should leave the runs of Zs and Ps, as well as the suffix exactly as received, but then change the Is to As, As to Os, or Os to Is, preserving case at each step.



Example Test Cases



zip         ==> zap
zAp ==> zOp
ZOP ==> ZIP
ZiiP ==> ZaaP
ZZaapp ==> ZZoopp
zzzzOoOPppP ==> zzzzIiIPppP
Zipperoni ==> Zapperoni
ZAPsky ==> ZOPsky
ZoPtOn ==> ZiPtOn
zipzip ==> zapzip
zapzopzip ==> zopzopzip
zoopzaap ==> ziipzaap


Rules and Notes




  • You may use any convenient character encoding for input and output, provided that it supports all printable ASCII characters, provided that it was created prior to this challenge.

  • You may assume the input word is some variant of Zip, Zap, or Zop. All other inputs result in undefined behavior.


    • Valid inputs will full-match the regex Z+(I+|A+|O+)P+.* (in mixed case)



  • You may assume that the input word consists entirely of ASCII letters.


Happy Golfing!










share|improve this question









$endgroup$

















    7












    $begingroup$


    There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever.



    Your task is to create a program that gives the next word in sequence given an input word. (Zip --> Zap --> Zop --> Zip) Since there's a lot of different ways to say these three words and flairs that can be added to them, your program should imitate case and letter duplication and carry suffixes.



    To elaborate, your input will be one or more Zs, then one or more Is, As, or Os (all the same letter), then one or more Ps, (all letters up to this point may be in mixed case) followed by some arbitrary suffix (which may be empty). You should leave the runs of Zs and Ps, as well as the suffix exactly as received, but then change the Is to As, As to Os, or Os to Is, preserving case at each step.



    Example Test Cases



    zip         ==> zap
    zAp ==> zOp
    ZOP ==> ZIP
    ZiiP ==> ZaaP
    ZZaapp ==> ZZoopp
    zzzzOoOPppP ==> zzzzIiIPppP
    Zipperoni ==> Zapperoni
    ZAPsky ==> ZOPsky
    ZoPtOn ==> ZiPtOn
    zipzip ==> zapzip
    zapzopzip ==> zopzopzip
    zoopzaap ==> ziipzaap


    Rules and Notes




    • You may use any convenient character encoding for input and output, provided that it supports all printable ASCII characters, provided that it was created prior to this challenge.

    • You may assume the input word is some variant of Zip, Zap, or Zop. All other inputs result in undefined behavior.


      • Valid inputs will full-match the regex Z+(I+|A+|O+)P+.* (in mixed case)



    • You may assume that the input word consists entirely of ASCII letters.


    Happy Golfing!










    share|improve this question









    $endgroup$















      7












      7








      7





      $begingroup$


      There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever.



      Your task is to create a program that gives the next word in sequence given an input word. (Zip --> Zap --> Zop --> Zip) Since there's a lot of different ways to say these three words and flairs that can be added to them, your program should imitate case and letter duplication and carry suffixes.



      To elaborate, your input will be one or more Zs, then one or more Is, As, or Os (all the same letter), then one or more Ps, (all letters up to this point may be in mixed case) followed by some arbitrary suffix (which may be empty). You should leave the runs of Zs and Ps, as well as the suffix exactly as received, but then change the Is to As, As to Os, or Os to Is, preserving case at each step.



      Example Test Cases



      zip         ==> zap
      zAp ==> zOp
      ZOP ==> ZIP
      ZiiP ==> ZaaP
      ZZaapp ==> ZZoopp
      zzzzOoOPppP ==> zzzzIiIPppP
      Zipperoni ==> Zapperoni
      ZAPsky ==> ZOPsky
      ZoPtOn ==> ZiPtOn
      zipzip ==> zapzip
      zapzopzip ==> zopzopzip
      zoopzaap ==> ziipzaap


      Rules and Notes




      • You may use any convenient character encoding for input and output, provided that it supports all printable ASCII characters, provided that it was created prior to this challenge.

      • You may assume the input word is some variant of Zip, Zap, or Zop. All other inputs result in undefined behavior.


        • Valid inputs will full-match the regex Z+(I+|A+|O+)P+.* (in mixed case)



      • You may assume that the input word consists entirely of ASCII letters.


      Happy Golfing!










      share|improve this question









      $endgroup$




      There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever.



      Your task is to create a program that gives the next word in sequence given an input word. (Zip --> Zap --> Zop --> Zip) Since there's a lot of different ways to say these three words and flairs that can be added to them, your program should imitate case and letter duplication and carry suffixes.



      To elaborate, your input will be one or more Zs, then one or more Is, As, or Os (all the same letter), then one or more Ps, (all letters up to this point may be in mixed case) followed by some arbitrary suffix (which may be empty). You should leave the runs of Zs and Ps, as well as the suffix exactly as received, but then change the Is to As, As to Os, or Os to Is, preserving case at each step.



      Example Test Cases



      zip         ==> zap
      zAp ==> zOp
      ZOP ==> ZIP
      ZiiP ==> ZaaP
      ZZaapp ==> ZZoopp
      zzzzOoOPppP ==> zzzzIiIPppP
      Zipperoni ==> Zapperoni
      ZAPsky ==> ZOPsky
      ZoPtOn ==> ZiPtOn
      zipzip ==> zapzip
      zapzopzip ==> zopzopzip
      zoopzaap ==> ziipzaap


      Rules and Notes




      • You may use any convenient character encoding for input and output, provided that it supports all printable ASCII characters, provided that it was created prior to this challenge.

      • You may assume the input word is some variant of Zip, Zap, or Zop. All other inputs result in undefined behavior.


        • Valid inputs will full-match the regex Z+(I+|A+|O+)P+.* (in mixed case)



      • You may assume that the input word consists entirely of ASCII letters.


      Happy Golfing!







      code-golf string






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      BeefsterBeefster

      1,772731




      1,772731






















          4 Answers
          4






          active

          oldest

          votes


















          1












          $begingroup$


          Stax, 19 bytes



          Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ


          Run and debug it






          share|improve this answer









          $endgroup$





















            1












            $begingroup$


            Perl 6, 41 bytes





            {S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}


            Try it online!



            Simple case-insensitive substitution to shift the vowel section.






            share|improve this answer









            $endgroup$





















              0












              $begingroup$


              Japt, 22 bytes



              r"%v+"_d"i_oiao_a"pu}"


              Try it online!






              share|improve this answer











              $endgroup$













              • $begingroup$
                "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                $endgroup$
                – Oliver
                14 secs ago





















              0












              $begingroup$


              JavaScript (Node.js), 69 bytes





              s=>Buffer(s).map(p=c=>s|p-c&31?s=c:c&1?c-[6,-14,p=c,,8][c%16%5]:c)+''


              Try it online!



              Commented



              s =>                        // s = input string
              Buffer(s) // convert it to a Buffer of ASCII codes
              .map(p = // initialize p to a non-numeric value
              c => // for each ASCII code c in s:
              s | // if s is numeric
              p - c & 31 ? // or p and c are not the same letter (case insensitive):
              s = c // turn s into a numeric value and yield c
              : // else:
              c & 1 ? // if c is a vowel:
              c - // update c to either c - 6 ('o' -> 'i'), c + 14
              [6, -14, p = c,, 8] // ('a' -> 'o') or c - 8 ('i' -> 'a'); and store c in p
              [c % 16 % 5] // small hash function to convert from ASCII code to index
              : // else (c is either 'z' or 'Z'):
              c // let it unchanged
              ) + '' // end of map(); coerce the Buffer back to a string





              share|improve this answer











              $endgroup$













                Your Answer





                StackExchange.ifUsing("editor", function () {
                return StackExchange.using("mathjaxEditing", function () {
                StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                });
                });
                }, "mathjax-editing");

                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%2f180463%2fplay-zip-zap-zop%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1












                $begingroup$


                Stax, 19 bytes



                Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ


                Run and debug it






                share|improve this answer









                $endgroup$


















                  1












                  $begingroup$


                  Stax, 19 bytes



                  Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ


                  Run and debug it






                  share|improve this answer









                  $endgroup$
















                    1












                    1








                    1





                    $begingroup$


                    Stax, 19 bytes



                    Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ


                    Run and debug it






                    share|improve this answer









                    $endgroup$




                    Stax, 19 bytes



                    Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ


                    Run and debug it







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 1 hour ago









                    recursiverecursive

                    5,3191322




                    5,3191322























                        1












                        $begingroup$


                        Perl 6, 41 bytes





                        {S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}


                        Try it online!



                        Simple case-insensitive substitution to shift the vowel section.






                        share|improve this answer









                        $endgroup$


















                          1












                          $begingroup$


                          Perl 6, 41 bytes





                          {S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}


                          Try it online!



                          Simple case-insensitive substitution to shift the vowel section.






                          share|improve this answer









                          $endgroup$
















                            1












                            1








                            1





                            $begingroup$


                            Perl 6, 41 bytes





                            {S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}


                            Try it online!



                            Simple case-insensitive substitution to shift the vowel section.






                            share|improve this answer









                            $endgroup$




                            Perl 6, 41 bytes





                            {S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}


                            Try it online!



                            Simple case-insensitive substitution to shift the vowel section.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 48 mins ago









                            Jo KingJo King

                            23.7k257123




                            23.7k257123























                                0












                                $begingroup$


                                Japt, 22 bytes



                                r"%v+"_d"i_oiao_a"pu}"


                                Try it online!






                                share|improve this answer











                                $endgroup$













                                • $begingroup$
                                  "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                                  $endgroup$
                                  – Oliver
                                  14 secs ago


















                                0












                                $begingroup$


                                Japt, 22 bytes



                                r"%v+"_d"i_oiao_a"pu}"


                                Try it online!






                                share|improve this answer











                                $endgroup$













                                • $begingroup$
                                  "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                                  $endgroup$
                                  – Oliver
                                  14 secs ago
















                                0












                                0








                                0





                                $begingroup$


                                Japt, 22 bytes



                                r"%v+"_d"i_oiao_a"pu}"


                                Try it online!






                                share|improve this answer











                                $endgroup$




                                Japt, 22 bytes



                                r"%v+"_d"i_oiao_a"pu}"


                                Try it online!







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 15 mins ago

























                                answered 41 mins ago









                                ASCII-onlyASCII-only

                                3,4421236




                                3,4421236












                                • $begingroup$
                                  "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                                  $endgroup$
                                  – Oliver
                                  14 secs ago




















                                • $begingroup$
                                  "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                                  $endgroup$
                                  – Oliver
                                  14 secs ago


















                                $begingroup$
                                "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                                $endgroup$
                                – Oliver
                                14 secs ago






                                $begingroup$
                                "%v+" won't match c so I don't think you have to worry about them in your replace string, right?
                                $endgroup$
                                – Oliver
                                14 secs ago













                                0












                                $begingroup$


                                JavaScript (Node.js), 69 bytes





                                s=>Buffer(s).map(p=c=>s|p-c&31?s=c:c&1?c-[6,-14,p=c,,8][c%16%5]:c)+''


                                Try it online!



                                Commented



                                s =>                        // s = input string
                                Buffer(s) // convert it to a Buffer of ASCII codes
                                .map(p = // initialize p to a non-numeric value
                                c => // for each ASCII code c in s:
                                s | // if s is numeric
                                p - c & 31 ? // or p and c are not the same letter (case insensitive):
                                s = c // turn s into a numeric value and yield c
                                : // else:
                                c & 1 ? // if c is a vowel:
                                c - // update c to either c - 6 ('o' -> 'i'), c + 14
                                [6, -14, p = c,, 8] // ('a' -> 'o') or c - 8 ('i' -> 'a'); and store c in p
                                [c % 16 % 5] // small hash function to convert from ASCII code to index
                                : // else (c is either 'z' or 'Z'):
                                c // let it unchanged
                                ) + '' // end of map(); coerce the Buffer back to a string





                                share|improve this answer











                                $endgroup$


















                                  0












                                  $begingroup$


                                  JavaScript (Node.js), 69 bytes





                                  s=>Buffer(s).map(p=c=>s|p-c&31?s=c:c&1?c-[6,-14,p=c,,8][c%16%5]:c)+''


                                  Try it online!



                                  Commented



                                  s =>                        // s = input string
                                  Buffer(s) // convert it to a Buffer of ASCII codes
                                  .map(p = // initialize p to a non-numeric value
                                  c => // for each ASCII code c in s:
                                  s | // if s is numeric
                                  p - c & 31 ? // or p and c are not the same letter (case insensitive):
                                  s = c // turn s into a numeric value and yield c
                                  : // else:
                                  c & 1 ? // if c is a vowel:
                                  c - // update c to either c - 6 ('o' -> 'i'), c + 14
                                  [6, -14, p = c,, 8] // ('a' -> 'o') or c - 8 ('i' -> 'a'); and store c in p
                                  [c % 16 % 5] // small hash function to convert from ASCII code to index
                                  : // else (c is either 'z' or 'Z'):
                                  c // let it unchanged
                                  ) + '' // end of map(); coerce the Buffer back to a string





                                  share|improve this answer











                                  $endgroup$
















                                    0












                                    0








                                    0





                                    $begingroup$


                                    JavaScript (Node.js), 69 bytes





                                    s=>Buffer(s).map(p=c=>s|p-c&31?s=c:c&1?c-[6,-14,p=c,,8][c%16%5]:c)+''


                                    Try it online!



                                    Commented



                                    s =>                        // s = input string
                                    Buffer(s) // convert it to a Buffer of ASCII codes
                                    .map(p = // initialize p to a non-numeric value
                                    c => // for each ASCII code c in s:
                                    s | // if s is numeric
                                    p - c & 31 ? // or p and c are not the same letter (case insensitive):
                                    s = c // turn s into a numeric value and yield c
                                    : // else:
                                    c & 1 ? // if c is a vowel:
                                    c - // update c to either c - 6 ('o' -> 'i'), c + 14
                                    [6, -14, p = c,, 8] // ('a' -> 'o') or c - 8 ('i' -> 'a'); and store c in p
                                    [c % 16 % 5] // small hash function to convert from ASCII code to index
                                    : // else (c is either 'z' or 'Z'):
                                    c // let it unchanged
                                    ) + '' // end of map(); coerce the Buffer back to a string





                                    share|improve this answer











                                    $endgroup$




                                    JavaScript (Node.js), 69 bytes





                                    s=>Buffer(s).map(p=c=>s|p-c&31?s=c:c&1?c-[6,-14,p=c,,8][c%16%5]:c)+''


                                    Try it online!



                                    Commented



                                    s =>                        // s = input string
                                    Buffer(s) // convert it to a Buffer of ASCII codes
                                    .map(p = // initialize p to a non-numeric value
                                    c => // for each ASCII code c in s:
                                    s | // if s is numeric
                                    p - c & 31 ? // or p and c are not the same letter (case insensitive):
                                    s = c // turn s into a numeric value and yield c
                                    : // else:
                                    c & 1 ? // if c is a vowel:
                                    c - // update c to either c - 6 ('o' -> 'i'), c + 14
                                    [6, -14, p = c,, 8] // ('a' -> 'o') or c - 8 ('i' -> 'a'); and store c in p
                                    [c % 16 % 5] // small hash function to convert from ASCII code to index
                                    : // else (c is either 'z' or 'Z'):
                                    c // let it unchanged
                                    ) + '' // end of map(); coerce the Buffer back to a string






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 16 secs ago

























                                    answered 22 mins ago









                                    ArnauldArnauld

                                    76.9k693322




                                    76.9k693322






























                                        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%2f180463%2fplay-zip-zap-zop%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

                                        Webac Holding Inhaltsverzeichnis Geschichte | Organisationsstruktur | Tochterfirmen |...

                                        What's the meaning of a knight fighting a snail in medieval book illustrations?What is the meaning of a glove...

                                        Salamanca Inhaltsverzeichnis Lage und Klima | Bevölkerungsentwicklung | Geschichte | Kultur und...