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
$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)
- Valid inputs will full-match the regex
- You may assume that the input word consists entirely of ASCII letters.
Happy Golfing!
code-golf string
$endgroup$
add a comment |
$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)
- Valid inputs will full-match the regex
- You may assume that the input word consists entirely of ASCII letters.
Happy Golfing!
code-golf string
$endgroup$
add a comment |
$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)
- Valid inputs will full-match the regex
- You may assume that the input word consists entirely of ASCII letters.
Happy Golfing!
code-golf string
$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)
- Valid inputs will full-match the regex
- You may assume that the input word consists entirely of ASCII letters.
Happy Golfing!
code-golf string
code-golf string
asked 1 hour ago
BeefsterBeefster
1,772731
1,772731
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
$begingroup$
Stax, 19 bytes
Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ
Run and debug it
$endgroup$
add a comment |
$begingroup$
Perl 6, 41 bytes
{S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}
Try it online!
Simple case-insensitive substitution to shift the vowel section.
$endgroup$
add a comment |
$begingroup$
Japt, 22 bytes
r"%v+"_d"i_oiao_a"pu}"
Try it online!
$endgroup$
$begingroup$
"%v+"won't matchcso I don't think you have to worry about them in your replace string, right?
$endgroup$
– Oliver
14 secs ago
add a comment |
$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
$endgroup$
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$begingroup$
Stax, 19 bytes
Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ
Run and debug it
$endgroup$
add a comment |
$begingroup$
Stax, 19 bytes
Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ
Run and debug it
$endgroup$
add a comment |
$begingroup$
Stax, 19 bytes
Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ
Run and debug it
$endgroup$
Stax, 19 bytes
Ç╛√êΣ%,╖FP╚`=Lh←⌡·ƒ
Run and debug it
answered 1 hour ago
recursiverecursive
5,3191322
5,3191322
add a comment |
add a comment |
$begingroup$
Perl 6, 41 bytes
{S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}
Try it online!
Simple case-insensitive substitution to shift the vowel section.
$endgroup$
add a comment |
$begingroup$
Perl 6, 41 bytes
{S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}
Try it online!
Simple case-insensitive substitution to shift the vowel section.
$endgroup$
add a comment |
$begingroup$
Perl 6, 41 bytes
{S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}
Try it online!
Simple case-insensitive substitution to shift the vowel section.
$endgroup$
Perl 6, 41 bytes
{S:i{z+<(.+?)>p}=$/.&{TR/iaoIAO/aoiAOI/}}
Try it online!
Simple case-insensitive substitution to shift the vowel section.
answered 48 mins ago
Jo KingJo King
23.7k257123
23.7k257123
add a comment |
add a comment |
$begingroup$
Japt, 22 bytes
r"%v+"_d"i_oiao_a"pu}"
Try it online!
$endgroup$
$begingroup$
"%v+"won't matchcso I don't think you have to worry about them in your replace string, right?
$endgroup$
– Oliver
14 secs ago
add a comment |
$begingroup$
Japt, 22 bytes
r"%v+"_d"i_oiao_a"pu}"
Try it online!
$endgroup$
$begingroup$
"%v+"won't matchcso I don't think you have to worry about them in your replace string, right?
$endgroup$
– Oliver
14 secs ago
add a comment |
$begingroup$
Japt, 22 bytes
r"%v+"_d"i_oiao_a"pu}"
Try it online!
$endgroup$
Japt, 22 bytes
r"%v+"_d"i_oiao_a"pu}"
Try it online!
edited 15 mins ago
answered 41 mins ago
ASCII-onlyASCII-only
3,4421236
3,4421236
$begingroup$
"%v+"won't matchcso I don't think you have to worry about them in your replace string, right?
$endgroup$
– Oliver
14 secs ago
add a comment |
$begingroup$
"%v+"won't matchcso 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
add a comment |
$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
$endgroup$
add a comment |
$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
$endgroup$
add a comment |
$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
$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
edited 16 secs ago
answered 22 mins ago
ArnauldArnauld
76.9k693322
76.9k693322
add a comment |
add a comment |
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).
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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