Make a Bowl of Alphabet Soup
$begingroup$
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK
Write a program that takes in a single letter character, A-Z, and outputs that same bowl of alphabet soup "rotated", so to speak, so the input letter appears where the A
does in the example above and the rest of the alphabet cycles fully around clockwise.
So the output for input A
would be that same original bowl of alphabet soup.
And the output for input B
would be this one:
YZABCD
WX EF
V G
U H
T I
SR KJ
QPONML
Likewise the output for H
would be:
EFGHIJ
CD KL
B M
A N
Z O
YX QP
WVUTSR
Or for Z
:
WXYZAB
UV CD
T E
S F
R G
QP IH
ONMLKJ
This needs to work for all 26 letters, A through Z.
Details:
- You can assume the only input will be a single letter, A through Z.
- If convenient you may use lowercase a-z for input and/or output, you can even mix and match lower and uppercase.
- The alphabet order must cycle clockwise, not counter-clockwise.
- You must use spaces, not something else, to indent and fill the soup bowl.
- There may be leading or trailing newlines or spaces in the output as long as the soup bowl is arranged properly.
- Note that the bowl shape is 12 characters wide by 7 tall to make it appear roughly circular as text. Your bowls need to be the same shape.
This is code golf so the shortest code wins!
code-golf string ascii-art
New contributor
$endgroup$
add a comment |
$begingroup$
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK
Write a program that takes in a single letter character, A-Z, and outputs that same bowl of alphabet soup "rotated", so to speak, so the input letter appears where the A
does in the example above and the rest of the alphabet cycles fully around clockwise.
So the output for input A
would be that same original bowl of alphabet soup.
And the output for input B
would be this one:
YZABCD
WX EF
V G
U H
T I
SR KJ
QPONML
Likewise the output for H
would be:
EFGHIJ
CD KL
B M
A N
Z O
YX QP
WVUTSR
Or for Z
:
WXYZAB
UV CD
T E
S F
R G
QP IH
ONMLKJ
This needs to work for all 26 letters, A through Z.
Details:
- You can assume the only input will be a single letter, A through Z.
- If convenient you may use lowercase a-z for input and/or output, you can even mix and match lower and uppercase.
- The alphabet order must cycle clockwise, not counter-clockwise.
- You must use spaces, not something else, to indent and fill the soup bowl.
- There may be leading or trailing newlines or spaces in the output as long as the soup bowl is arranged properly.
- Note that the bowl shape is 12 characters wide by 7 tall to make it appear roughly circular as text. Your bowls need to be the same shape.
This is code golf so the shortest code wins!
code-golf string ascii-art
New contributor
$endgroup$
5
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
5 hours ago
add a comment |
$begingroup$
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK
Write a program that takes in a single letter character, A-Z, and outputs that same bowl of alphabet soup "rotated", so to speak, so the input letter appears where the A
does in the example above and the rest of the alphabet cycles fully around clockwise.
So the output for input A
would be that same original bowl of alphabet soup.
And the output for input B
would be this one:
YZABCD
WX EF
V G
U H
T I
SR KJ
QPONML
Likewise the output for H
would be:
EFGHIJ
CD KL
B M
A N
Z O
YX QP
WVUTSR
Or for Z
:
WXYZAB
UV CD
T E
S F
R G
QP IH
ONMLKJ
This needs to work for all 26 letters, A through Z.
Details:
- You can assume the only input will be a single letter, A through Z.
- If convenient you may use lowercase a-z for input and/or output, you can even mix and match lower and uppercase.
- The alphabet order must cycle clockwise, not counter-clockwise.
- You must use spaces, not something else, to indent and fill the soup bowl.
- There may be leading or trailing newlines or spaces in the output as long as the soup bowl is arranged properly.
- Note that the bowl shape is 12 characters wide by 7 tall to make it appear roughly circular as text. Your bowls need to be the same shape.
This is code golf so the shortest code wins!
code-golf string ascii-art
New contributor
$endgroup$
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK
Write a program that takes in a single letter character, A-Z, and outputs that same bowl of alphabet soup "rotated", so to speak, so the input letter appears where the A
does in the example above and the rest of the alphabet cycles fully around clockwise.
So the output for input A
would be that same original bowl of alphabet soup.
And the output for input B
would be this one:
YZABCD
WX EF
V G
U H
T I
SR KJ
QPONML
Likewise the output for H
would be:
EFGHIJ
CD KL
B M
A N
Z O
YX QP
WVUTSR
Or for Z
:
WXYZAB
UV CD
T E
S F
R G
QP IH
ONMLKJ
This needs to work for all 26 letters, A through Z.
Details:
- You can assume the only input will be a single letter, A through Z.
- If convenient you may use lowercase a-z for input and/or output, you can even mix and match lower and uppercase.
- The alphabet order must cycle clockwise, not counter-clockwise.
- You must use spaces, not something else, to indent and fill the soup bowl.
- There may be leading or trailing newlines or spaces in the output as long as the soup bowl is arranged properly.
- Note that the bowl shape is 12 characters wide by 7 tall to make it appear roughly circular as text. Your bowls need to be the same shape.
This is code golf so the shortest code wins!
code-golf string ascii-art
code-golf string ascii-art
New contributor
New contributor
New contributor
asked 5 hours ago
Discrete GamesDiscrete Games
50627
50627
New contributor
New contributor
5
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
5 hours ago
add a comment |
5
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
5 hours ago
5
5
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
5 hours ago
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
5 hours ago
add a comment |
8 Answers
8
active
oldest
votes
$begingroup$
05AB1E, 21 bytes
A roughly straightforward approach. Most likely golfable.
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
$endgroup$
add a comment |
$begingroup$
MATL, 49 bytes
7I8*32tvB[1b]&Zvc2Y2j7+_YSy&f7-w4-_Z;YPE,&S])yg(
What a mess. But it was fun writing. There's even an arctangent involved.
Try it online!
$endgroup$
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
add a comment |
$begingroup$
JavaScript (Node.js), 121 bytes
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>1/x?''.padEnd(-~x):(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
$endgroup$
add a comment |
$begingroup$
Charcoal, 33 bytes
GH→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→²✂⁺αα⌕αS
Try it online! Link is to verbose version of code. Explanation:
GH
Trace a path.
→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→
Outline the bowl. Each 7
expands to ↙←
.
²
Move one character at a time (this API overlaps each line's ends with the next).
✂⁺αα⌕αS
Draw using the doubled alphabet, but starting at the position of the input character.
$endgroup$
add a comment |
$begingroup$
Perl 6, 100 bytes
{"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>{(try ' 'x$/+1)||chr ($/.ord+.ord)%26+65})}
Try it online!
Replaces all letters in the string with their shifted counterparts, while replacing digits with the number of spaces they represent plus one.
Explanation
{ }# Anonymous code block
"...".trans(/S/=>{ }) # Translate non-whitespace
(try ' 'x$/+1) # If digits, the amount of spaces plus one
||chr ($/.ord+.ord)%26+64 # Else the shifted letter
$endgroup$
add a comment |
$begingroup$
Python 2, 129 bytes
lambda x:''.join((i,chr((ord(x)+ord(i))%26+65),' '*5)[ord(i)/46]for i in''' XYZABC
VW] DE
U]]F
T]]G
S]]H
RQ] JI
PONMLK''')
Try it online!
$endgroup$
add a comment |
$begingroup$
Wolfram Language (Mathematica), 258 bytes
(t[x_]:=Table[" ",x];w=RotateRight[Alphabet,4-LetterNumber@#];j=Join;a[x_,y_]:=j[{w[[x]]},t@10,{w[[y]]}];b[m_,n_]:=j[t@1,w[[m;;m+1]],t@6,w[[n;;n+1]],t@1];""<>#&/@{j[t@3,w[[1;;6]]],b[25,7],a[24,9],a[23,10],a[22,11],Reverse@b[12,20],j[t@3,w[[19;;14;;-1]]]})&
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 119 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=("i".to_c**((i.ord-n.ord+0.5)/6.5)).rect;a[3.5-j*3.3][6+k*5.17]=i}
puts a}
Uses a complex number raised to a power to map to an ellipse. A complete turn is 26, so each quadrant is 6.5.
This approach relies on the required output resembling an ellipse sufficiently that a valid mapping can be achieved.
Try it online!
$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
});
}
});
Discrete Games is a new contributor. Be nice, and check out our Code of Conduct.
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%2f181843%2fmake-a-bowl-of-alphabet-soup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
05AB1E, 21 bytes
A roughly straightforward approach. Most likely golfable.
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
$endgroup$
add a comment |
$begingroup$
05AB1E, 21 bytes
A roughly straightforward approach. Most likely golfable.
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
$endgroup$
add a comment |
$begingroup$
05AB1E, 21 bytes
A roughly straightforward approach. Most likely golfable.
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
$endgroup$
05AB1E, 21 bytes
A roughly straightforward approach. Most likely golfable.
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
answered 4 hours ago
AdnanAdnan
35.8k562225
35.8k562225
add a comment |
add a comment |
$begingroup$
MATL, 49 bytes
7I8*32tvB[1b]&Zvc2Y2j7+_YSy&f7-w4-_Z;YPE,&S])yg(
What a mess. But it was fun writing. There's even an arctangent involved.
Try it online!
$endgroup$
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
add a comment |
$begingroup$
MATL, 49 bytes
7I8*32tvB[1b]&Zvc2Y2j7+_YSy&f7-w4-_Z;YPE,&S])yg(
What a mess. But it was fun writing. There's even an arctangent involved.
Try it online!
$endgroup$
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
add a comment |
$begingroup$
MATL, 49 bytes
7I8*32tvB[1b]&Zvc2Y2j7+_YSy&f7-w4-_Z;YPE,&S])yg(
What a mess. But it was fun writing. There's even an arctangent involved.
Try it online!
$endgroup$
MATL, 49 bytes
7I8*32tvB[1b]&Zvc2Y2j7+_YSy&f7-w4-_Z;YPE,&S])yg(
What a mess. But it was fun writing. There's even an arctangent involved.
Try it online!
edited 4 hours ago
answered 4 hours ago
Luis MendoLuis Mendo
74.9k888291
74.9k888291
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
add a comment |
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
$begingroup$
@EriktheOutgolfer :-? It sorts the non-space entries by their angle with respect to center of the bowl. That defines the order in which letters must be written. I'll add a more detailed explanation tomorrow if I have time
$endgroup$
– Luis Mendo
4 hours ago
add a comment |
$begingroup$
JavaScript (Node.js), 121 bytes
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>1/x?''.padEnd(-~x):(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript (Node.js), 121 bytes
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>1/x?''.padEnd(-~x):(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript (Node.js), 121 bytes
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>1/x?''.padEnd(-~x):(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
$endgroup$
JavaScript (Node.js), 121 bytes
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>1/x?''.padEnd(-~x):(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
answered 4 hours ago
ArnauldArnauld
79.2k796330
79.2k796330
add a comment |
add a comment |
$begingroup$
Charcoal, 33 bytes
GH→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→²✂⁺αα⌕αS
Try it online! Link is to verbose version of code. Explanation:
GH
Trace a path.
→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→
Outline the bowl. Each 7
expands to ↙←
.
²
Move one character at a time (this API overlaps each line's ends with the next).
✂⁺αα⌕αS
Draw using the doubled alphabet, but starting at the position of the input character.
$endgroup$
add a comment |
$begingroup$
Charcoal, 33 bytes
GH→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→²✂⁺αα⌕αS
Try it online! Link is to verbose version of code. Explanation:
GH
Trace a path.
→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→
Outline the bowl. Each 7
expands to ↙←
.
²
Move one character at a time (this API overlaps each line's ends with the next).
✂⁺αα⌕αS
Draw using the doubled alphabet, but starting at the position of the input character.
$endgroup$
add a comment |
$begingroup$
Charcoal, 33 bytes
GH→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→²✂⁺αα⌕αS
Try it online! Link is to verbose version of code. Explanation:
GH
Trace a path.
→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→
Outline the bowl. Each 7
expands to ↙←
.
²
Move one character at a time (this API overlaps each line's ends with the next).
✂⁺αα⌕αS
Draw using the doubled alphabet, but starting at the position of the input character.
$endgroup$
Charcoal, 33 bytes
GH→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→²✂⁺αα⌕αS
Try it online! Link is to verbose version of code. Explanation:
GH
Trace a path.
→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→
Outline the bowl. Each 7
expands to ↙←
.
²
Move one character at a time (this API overlaps each line's ends with the next).
✂⁺αα⌕αS
Draw using the doubled alphabet, but starting at the position of the input character.
answered 2 hours ago
NeilNeil
81.8k745178
81.8k745178
add a comment |
add a comment |
$begingroup$
Perl 6, 100 bytes
{"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>{(try ' 'x$/+1)||chr ($/.ord+.ord)%26+65})}
Try it online!
Replaces all letters in the string with their shifted counterparts, while replacing digits with the number of spaces they represent plus one.
Explanation
{ }# Anonymous code block
"...".trans(/S/=>{ }) # Translate non-whitespace
(try ' 'x$/+1) # If digits, the amount of spaces plus one
||chr ($/.ord+.ord)%26+64 # Else the shifted letter
$endgroup$
add a comment |
$begingroup$
Perl 6, 100 bytes
{"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>{(try ' 'x$/+1)||chr ($/.ord+.ord)%26+65})}
Try it online!
Replaces all letters in the string with their shifted counterparts, while replacing digits with the number of spaces they represent plus one.
Explanation
{ }# Anonymous code block
"...".trans(/S/=>{ }) # Translate non-whitespace
(try ' 'x$/+1) # If digits, the amount of spaces plus one
||chr ($/.ord+.ord)%26+64 # Else the shifted letter
$endgroup$
add a comment |
$begingroup$
Perl 6, 100 bytes
{"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>{(try ' 'x$/+1)||chr ($/.ord+.ord)%26+65})}
Try it online!
Replaces all letters in the string with their shifted counterparts, while replacing digits with the number of spaces they represent plus one.
Explanation
{ }# Anonymous code block
"...".trans(/S/=>{ }) # Translate non-whitespace
(try ' 'x$/+1) # If digits, the amount of spaces plus one
||chr ($/.ord+.ord)%26+64 # Else the shifted letter
$endgroup$
Perl 6, 100 bytes
{"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>{(try ' 'x$/+1)||chr ($/.ord+.ord)%26+65})}
Try it online!
Replaces all letters in the string with their shifted counterparts, while replacing digits with the number of spaces they represent plus one.
Explanation
{ }# Anonymous code block
"...".trans(/S/=>{ }) # Translate non-whitespace
(try ' 'x$/+1) # If digits, the amount of spaces plus one
||chr ($/.ord+.ord)%26+64 # Else the shifted letter
edited 1 hour ago
answered 1 hour ago
Jo KingJo King
25k359128
25k359128
add a comment |
add a comment |
$begingroup$
Python 2, 129 bytes
lambda x:''.join((i,chr((ord(x)+ord(i))%26+65),' '*5)[ord(i)/46]for i in''' XYZABC
VW] DE
U]]F
T]]G
S]]H
RQ] JI
PONMLK''')
Try it online!
$endgroup$
add a comment |
$begingroup$
Python 2, 129 bytes
lambda x:''.join((i,chr((ord(x)+ord(i))%26+65),' '*5)[ord(i)/46]for i in''' XYZABC
VW] DE
U]]F
T]]G
S]]H
RQ] JI
PONMLK''')
Try it online!
$endgroup$
add a comment |
$begingroup$
Python 2, 129 bytes
lambda x:''.join((i,chr((ord(x)+ord(i))%26+65),' '*5)[ord(i)/46]for i in''' XYZABC
VW] DE
U]]F
T]]G
S]]H
RQ] JI
PONMLK''')
Try it online!
$endgroup$
Python 2, 129 bytes
lambda x:''.join((i,chr((ord(x)+ord(i))%26+65),' '*5)[ord(i)/46]for i in''' XYZABC
VW] DE
U]]F
T]]G
S]]H
RQ] JI
PONMLK''')
Try it online!
answered 4 hours ago
Erik the OutgolferErik the Outgolfer
32.6k429105
32.6k429105
add a comment |
add a comment |
$begingroup$
Wolfram Language (Mathematica), 258 bytes
(t[x_]:=Table[" ",x];w=RotateRight[Alphabet,4-LetterNumber@#];j=Join;a[x_,y_]:=j[{w[[x]]},t@10,{w[[y]]}];b[m_,n_]:=j[t@1,w[[m;;m+1]],t@6,w[[n;;n+1]],t@1];""<>#&/@{j[t@3,w[[1;;6]]],b[25,7],a[24,9],a[23,10],a[22,11],Reverse@b[12,20],j[t@3,w[[19;;14;;-1]]]})&
Try it online!
$endgroup$
add a comment |
$begingroup$
Wolfram Language (Mathematica), 258 bytes
(t[x_]:=Table[" ",x];w=RotateRight[Alphabet,4-LetterNumber@#];j=Join;a[x_,y_]:=j[{w[[x]]},t@10,{w[[y]]}];b[m_,n_]:=j[t@1,w[[m;;m+1]],t@6,w[[n;;n+1]],t@1];""<>#&/@{j[t@3,w[[1;;6]]],b[25,7],a[24,9],a[23,10],a[22,11],Reverse@b[12,20],j[t@3,w[[19;;14;;-1]]]})&
Try it online!
$endgroup$
add a comment |
$begingroup$
Wolfram Language (Mathematica), 258 bytes
(t[x_]:=Table[" ",x];w=RotateRight[Alphabet,4-LetterNumber@#];j=Join;a[x_,y_]:=j[{w[[x]]},t@10,{w[[y]]}];b[m_,n_]:=j[t@1,w[[m;;m+1]],t@6,w[[n;;n+1]],t@1];""<>#&/@{j[t@3,w[[1;;6]]],b[25,7],a[24,9],a[23,10],a[22,11],Reverse@b[12,20],j[t@3,w[[19;;14;;-1]]]})&
Try it online!
$endgroup$
Wolfram Language (Mathematica), 258 bytes
(t[x_]:=Table[" ",x];w=RotateRight[Alphabet,4-LetterNumber@#];j=Join;a[x_,y_]:=j[{w[[x]]},t@10,{w[[y]]}];b[m_,n_]:=j[t@1,w[[m;;m+1]],t@6,w[[n;;n+1]],t@1];""<>#&/@{j[t@3,w[[1;;6]]],b[25,7],a[24,9],a[23,10],a[22,11],Reverse@b[12,20],j[t@3,w[[19;;14;;-1]]]})&
Try it online!
answered 3 hours ago
J42161217J42161217
13.3k21251
13.3k21251
add a comment |
add a comment |
$begingroup$
Ruby, 119 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=("i".to_c**((i.ord-n.ord+0.5)/6.5)).rect;a[3.5-j*3.3][6+k*5.17]=i}
puts a}
Uses a complex number raised to a power to map to an ellipse. A complete turn is 26, so each quadrant is 6.5.
This approach relies on the required output resembling an ellipse sufficiently that a valid mapping can be achieved.
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 119 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=("i".to_c**((i.ord-n.ord+0.5)/6.5)).rect;a[3.5-j*3.3][6+k*5.17]=i}
puts a}
Uses a complex number raised to a power to map to an ellipse. A complete turn is 26, so each quadrant is 6.5.
This approach relies on the required output resembling an ellipse sufficiently that a valid mapping can be achieved.
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 119 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=("i".to_c**((i.ord-n.ord+0.5)/6.5)).rect;a[3.5-j*3.3][6+k*5.17]=i}
puts a}
Uses a complex number raised to a power to map to an ellipse. A complete turn is 26, so each quadrant is 6.5.
This approach relies on the required output resembling an ellipse sufficiently that a valid mapping can be achieved.
Try it online!
$endgroup$
Ruby, 119 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=("i".to_c**((i.ord-n.ord+0.5)/6.5)).rect;a[3.5-j*3.3][6+k*5.17]=i}
puts a}
Uses a complex number raised to a power to map to an ellipse. A complete turn is 26, so each quadrant is 6.5.
This approach relies on the required output resembling an ellipse sufficiently that a valid mapping can be achieved.
Try it online!
answered 2 hours ago
Level River StLevel River St
20.4k32680
20.4k32680
add a comment |
add a comment |
Discrete Games is a new contributor. Be nice, and check out our Code of Conduct.
Discrete Games is a new contributor. Be nice, and check out our Code of Conduct.
Discrete Games is a new contributor. Be nice, and check out our Code of Conduct.
Discrete Games is a new contributor. Be nice, and check out our Code of Conduct.
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%2f181843%2fmake-a-bowl-of-alphabet-soup%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
5
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
5 hours ago