Make a Bowl of Alphabet SoupPrint custom alphabetNumbers for LettersAlphabet to Number and Number to AlphabetRoll the Alphabet into a SpiralBuild an Alphabet PyramidFizz-Buzzify a StringSemi-Diagonal AlphabetMake an alphabet searchlight!The Speed of LettersWrite a function/method that takes in a string and spells that word out using the NATO Phonetic Alphabet. Titlecase optional
What happens if I try to grapple mirror image?
Quoting Keynes in a lecture
How to test the sharpness of a knife?
I'm just a whisper. Who am I?
Anime with legendary swords made from talismans and a man who could change them with a shattered body
How do I prevent inappropriate ads from appearing in my game?
Is there a distance limit for minecart tracks?
Unable to disable Microsoft Store in domain environment
Confusion over Hunter with Crossbow Expert and Giant Killer
Why is participating in the European Parliamentary elections used as a threat?
Review your own paper in Mathematics
How do I tell my boss that I'm quitting in 15 days (a colleague left this week)
The Digit Triangles
Given this phrasing in the lease, when should I pay my rent?
Does Doodling or Improvising on the Piano Have Any Benefits?
Do I have to take mana from my deck or hand when tapping a dual land?
Can you identify this lizard-like creature I observed in the UK?
How do I fix the group tension caused by my character stealing and possibly killing without provocation?
What is the smallest number n> 5 so that 5 ^ n ends with "3125"?
Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?
Ways of geometrical multiplication
What should be the ideal length of sentences in a blog post for ease of reading?
Should I warn a new PhD Student?
"Oh no!" in Latin
Make a Bowl of Alphabet Soup
Print custom alphabetNumbers for LettersAlphabet to Number and Number to AlphabetRoll the Alphabet into a SpiralBuild an Alphabet PyramidFizz-Buzzify a StringSemi-Diagonal AlphabetMake an alphabet searchlight!The Speed of LettersWrite a function/method that takes in a string and spells that word out using the NATO Phonetic Alphabet. Titlecase optional
$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
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$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
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
11
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
yesterday
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
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$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
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday
Discrete GamesDiscrete Games
68138
68138
New contributor
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Discrete Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
11
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
yesterday
add a comment |
11
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
yesterday
11
11
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
yesterday
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
yesterday
add a comment |
16 Answers
16
active
oldest
votes
$begingroup$
05AB1E, 21 bytes
Defines a program $f : colorpurpletextttAlphabeticChar rightarrow colorpurpletextttString$
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
Breakdown:
2AA¹k._•1못*Ć,ãiDΣ•Λ
2 # <length>
AA¹k._ # <filler>
•1못*Ć,ãiDΣ• # <pattern>
Λ # Invoke the canvas function.
Explanation:
The canvas (Λ) in this particular context works as a function with the following signature:
$$
mathsfLambda : left(textttlength: colorpurpletextttNat, textttfiller: colorpurpletextttString, textttpattern: colorpurpletextttNatright) rightarrow colorpurpletextttString
$$
The $textttpattern$ parameter is in this situation a number defining the directions. In the code, this number is represented as •1못*Ć,ãiDΣ•, which is a compressed version of the big number $2232344565666667670012122$. Directions are denoted in the following manner:
$$
beginarrayl
7 & & 0 & & 1 \
& nwarrow & uparrow & nearrow & \
6 & leftarrow & bullet & rightarrow & 2 \
& swarrow & downarrow & searrow & \
5 & & 4 & & 3
endarray
$$
This means that the big number represents the following pattern of directions:
$$
[rightarrow, rightarrow, searrow, rightarrow, searrow, downarrow, downarrow, swarrow, leftarrow, swarrow, leftarrow, leftarrow, leftarrow, leftarrow, leftarrow, nwarrow, leftarrow, nwarrow, uparrow, uparrow, nearrow, rightarrow, nearrow, rightarrow, rightarrow]
$$
With this signature context, the canvas iterates through the $textttpattern$ list and writes $textttlength$ characters from the $textttfiller$ in the current direction.
The $textttlength$ is specified in the code as $2$ (at the beginning of the code). For the $textttfiller$, we need a rotated version of the alphabet such that it starts with the given input. That is done with the following code (try it here):
AA¹k._
A¹k # Find the <index> of the given input character in the alphabet
A ._ # Rotate the alphabet to the left <index> times.
In pseudocode, this would be executed by the canvas function:
$
beginarrayl
1. & textWrite colorbluetextttab text in the direction rightarrow \
2. & textWrite colorbluetextttbc text in the direction rightarrow \
3. & textWrite colorbluetextttcd text in the direction searrow \
4. & textWrite colorbluetextttde text in the direction rightarrow \
5. & textWrite colorbluetextttef text in the direction searrow \
6. & textWrite colorbluetextttfg text in the direction downarrow \
dots
endarray
$
Lastly, you can see that the filler argument is 'rotated' $textttlength - 1$ times to the right, meaning that the canvas would iterate through the following (cycled and therefore infinite) list:
$$
[colorbluetextttab, colorbluetextttbc, colorbluetextttcd, colorbluetextttde, colorbluetextttef, colorbluetextttfg, colorbluetextttgh, colorbluetexttthi, colorbluetextttij, colorbluetextttjk, ...
$$
Which results in the desired alphabet soup ascii-art shape.
$endgroup$
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.AA¹k._can alternatively beA¹¡RJ«, but it's the same byte-count.•1못*Ć,ãiDΣ•can alternatively be•õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!
$endgroup$
– Kevin Cruijssen
10 hours ago
add a comment |
$begingroup$
Perl 6, 100 bytes
"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>(try ' 'x$/+1))
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$
Ruby, 107 bytes
->na=(0..6).map' '*11
(?A..?Z).mapi
a*$/
Try it online!
Improved syntax "i".to_c -> 1i (Suggested by Jordan)
Changed coordinate system so 0 degrees is at right instead of top. This enables 0.5 -> 6
Adjusted multipliers of j and k for shortness
Rather than print output puts a, concatenate array elements and return a string a*$/
Ruby, 119 bytes
->na=(0..6).map' '*11
(?A..?Z).map
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$
$begingroup$
Instead of"i".to_ccan you just do1i?
$endgroup$
– Jordan
8 hours ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour 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
yesterday
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$
JavaScript (Node.js), 121 119 bytes
Saved 2 bytes thanks to @tsh
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>''.padEnd(+x+1)||(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
How?
This code abuses Buffer to extract the ASCII codes of the template letter $x$ and input letter $c$ and convert them back into the target letter.
Example with $c=$"H" and $x=$"B"
// extracting the ASCII codes
Buffer(c + x) → Buffer("HB") → <Buffer 48 42>
// assigning them to variables
[a, b] = Buffer(c + x) → a = 0x48 (72) and b = 0x42 (66)
// computing the ASCII code of the target letter
65 + ((a + b) % 26) → 65 + (138 % 26) → 65 + 8 → 73
// turning it back into a character
Buffer([73]) → <Buffer 49> → implicitly coerced to "I" by replace()
$endgroup$
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
add a comment |
$begingroup$
R, 139 122 bytes
-17 bytes thanks to Giuseppe
u=utf8ToInt;`*`=rep;o=c(' '*12,'
')*7;o[u(" &3@LKWVUTSRDC5(")]=LETTERS[(13:38+u(scan(,'')))%%26+1];cat(o,sep='')
Explanation:
o=rep(c(rep(' ',12),'
'),7)
Builds an empty box of spaces
u(" &3@LKWVUTSRDC5(")
is a set of indices for letter positions corresponding to:
c(7:9,23,24,38,51,64,76,75,87:82,68,67,53,40,27,15,16,4:6)
TIO
$endgroup$
1
$begingroup$
you never useintToUtf8so those are extraneous bytes, but if you use*in place ofrep, you can get save 2 bytes and get to 125 bytes
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the-32, for 122 bytes. You can generate them yourself by usingcat(intToUtf8(bytes)).
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed theintToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks
$endgroup$
– Aaron Hayman
2 hours ago
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$
R, 218 197 bytes
-21 bytes thanks to Giuseppe
function(t,l=letters,`*`=rep,s=" ",n="
",`~`=`[`,r=c(l~l>=t,l))cat(s*3,r~24:26,r~1:3,n,s,r~22:23,q<-s*6,r~4:5,n,r~21,u<-s*10,r~6,n,r~20,u,r~7,n,r~19,u,r~8,n,s,r~17:18,q,r~10:9,n,s*3,r~16:11,sep='')
Try it online!
Ungolfed:
alphasoup <- function(startlet)
startnum <- which(l == startlet)
rotatedletters <- c(letters[startnum:26], letters[1:(startnum -1)])[1:26]
cat(' ',rotatedletters[24:26],rotatedletters[1:3], 'n ',
rotatedletters[22:23], s6 <- ' ', rotatedletters[4:5], 'n',
rotatedletters[21], s10 <- rep(' ', 10), rotatedletters[6], 'n',
rotatedletters[20], s10, rotatedletters[7], 'n',
rotatedletters[19], s10, rotatedletters[8], 'n ',
rotatedletters[17:18], s6, rotatedletters[10:9], 'n ',
rotatedletters[16:11],
sep = '')
Created rotated letter vector and uses cat to fill out rim of bowl with that vector.
$endgroup$
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing thewhichand usingl>=tas the index directly, which was worth 12 bytes.
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
198 bytes by aliasing[with~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
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$
APL+WIN, 72 bytes
Prompts for character
m←7 12⍴' '⋄n←(7⍴2)⊤v,⌽v←(⍳3)/28 34 65⋄((,n)/,m)←(22+s⍳⎕)⌽s←⎕av[65+⍳26]⋄m
Try it online!Coutesy of Dyalog Classic
$endgroup$
add a comment |
$begingroup$
Red, 139 bytes
func[a][foreach c XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK[if c > sp[c: c + a % 26 + 65]prin c]]
Try it online!
A really naive solution.
$endgroup$
add a comment |
$begingroup$
TSQL query, 240 bytes
DECLARE @y char='G'
,@ char(91)='';WITH C as(SELECT 7a,'5585877636333330301122555'z,ascii(@y)x
UNION ALL
SELECT a+left(z,1)/3*13+left(z,1)%3-14,stuff(z,1,1,''),(x+14)%26+65FROM
C WHERE''<z)SELECT
@=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))FROM
C PRINT @
The output starts with a blank line.
The long list of numbers represents directions.
I would have made a try it out link, but the site was messing up the output. Hopefully some nice person, will verify that this works in SQL Server Management Studio.
$endgroup$
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
add a comment |
$begingroup$
Perl 5 -p, 110 bytes
$b=/A/?Z:chr(-1+ord);$_=eval("'2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK'=~y/A-Z/$_-ZA-$b/r");s/d/$".$"x$&/eg
Try it online!
$endgroup$
add a comment |
$begingroup$
Kotlin, 148 bytes
l:Char->"""2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK""".mapc->if(c>'@')(((c-'A')+(l-'A'))%26+65).toChar()
else if(c>' ')" ".repeat(c-'/')
else c
Try it online!
$endgroup$
add a comment |
$begingroup$
Haskell, 127 bytes
("cXYZABC aVWfDE UjF TjG SjH aRQfJI cPONMLK">>=).(?)
t?c|c>'Z'=' '<$['a'..c]|c<'!'="n"|t<'B'=[c]|c>'Y'=t?'@'|1<2=pred t?succ c
Try it online!
Each character in the encoded string is decoded by function ? into a string:
t?c -- 't' is the starting char,
-- 'c' the char from the encoded string
|c>'Z'=' '<$['a'..c] -- if 'c' is a lowercase letter, return some spaces
-- 'a': one, 'b': two, etc
|c<'!'="n" -- if 'c' is a space, return a newline
|t<'B'=[c] -- if 't' is the letter A, return 'c'
|c>'Y'=t?'@' -- wrap around Z
|1<2=pred t?succ c -- else the result is the same as starting one letter
-- earlier (pred t) but looking at the successor of 'c'
$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
16 Answers
16
active
oldest
votes
16 Answers
16
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
05AB1E, 21 bytes
Defines a program $f : colorpurpletextttAlphabeticChar rightarrow colorpurpletextttString$
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
Breakdown:
2AA¹k._•1못*Ć,ãiDΣ•Λ
2 # <length>
AA¹k._ # <filler>
•1못*Ć,ãiDΣ• # <pattern>
Λ # Invoke the canvas function.
Explanation:
The canvas (Λ) in this particular context works as a function with the following signature:
$$
mathsfLambda : left(textttlength: colorpurpletextttNat, textttfiller: colorpurpletextttString, textttpattern: colorpurpletextttNatright) rightarrow colorpurpletextttString
$$
The $textttpattern$ parameter is in this situation a number defining the directions. In the code, this number is represented as •1못*Ć,ãiDΣ•, which is a compressed version of the big number $2232344565666667670012122$. Directions are denoted in the following manner:
$$
beginarrayl
7 & & 0 & & 1 \
& nwarrow & uparrow & nearrow & \
6 & leftarrow & bullet & rightarrow & 2 \
& swarrow & downarrow & searrow & \
5 & & 4 & & 3
endarray
$$
This means that the big number represents the following pattern of directions:
$$
[rightarrow, rightarrow, searrow, rightarrow, searrow, downarrow, downarrow, swarrow, leftarrow, swarrow, leftarrow, leftarrow, leftarrow, leftarrow, leftarrow, nwarrow, leftarrow, nwarrow, uparrow, uparrow, nearrow, rightarrow, nearrow, rightarrow, rightarrow]
$$
With this signature context, the canvas iterates through the $textttpattern$ list and writes $textttlength$ characters from the $textttfiller$ in the current direction.
The $textttlength$ is specified in the code as $2$ (at the beginning of the code). For the $textttfiller$, we need a rotated version of the alphabet such that it starts with the given input. That is done with the following code (try it here):
AA¹k._
A¹k # Find the <index> of the given input character in the alphabet
A ._ # Rotate the alphabet to the left <index> times.
In pseudocode, this would be executed by the canvas function:
$
beginarrayl
1. & textWrite colorbluetextttab text in the direction rightarrow \
2. & textWrite colorbluetextttbc text in the direction rightarrow \
3. & textWrite colorbluetextttcd text in the direction searrow \
4. & textWrite colorbluetextttde text in the direction rightarrow \
5. & textWrite colorbluetextttef text in the direction searrow \
6. & textWrite colorbluetextttfg text in the direction downarrow \
dots
endarray
$
Lastly, you can see that the filler argument is 'rotated' $textttlength - 1$ times to the right, meaning that the canvas would iterate through the following (cycled and therefore infinite) list:
$$
[colorbluetextttab, colorbluetextttbc, colorbluetextttcd, colorbluetextttde, colorbluetextttef, colorbluetextttfg, colorbluetextttgh, colorbluetexttthi, colorbluetextttij, colorbluetextttjk, ...
$$
Which results in the desired alphabet soup ascii-art shape.
$endgroup$
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.AA¹k._can alternatively beA¹¡RJ«, but it's the same byte-count.•1못*Ć,ãiDΣ•can alternatively be•õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!
$endgroup$
– Kevin Cruijssen
10 hours ago
add a comment |
$begingroup$
05AB1E, 21 bytes
Defines a program $f : colorpurpletextttAlphabeticChar rightarrow colorpurpletextttString$
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
Breakdown:
2AA¹k._•1못*Ć,ãiDΣ•Λ
2 # <length>
AA¹k._ # <filler>
•1못*Ć,ãiDΣ• # <pattern>
Λ # Invoke the canvas function.
Explanation:
The canvas (Λ) in this particular context works as a function with the following signature:
$$
mathsfLambda : left(textttlength: colorpurpletextttNat, textttfiller: colorpurpletextttString, textttpattern: colorpurpletextttNatright) rightarrow colorpurpletextttString
$$
The $textttpattern$ parameter is in this situation a number defining the directions. In the code, this number is represented as •1못*Ć,ãiDΣ•, which is a compressed version of the big number $2232344565666667670012122$. Directions are denoted in the following manner:
$$
beginarrayl
7 & & 0 & & 1 \
& nwarrow & uparrow & nearrow & \
6 & leftarrow & bullet & rightarrow & 2 \
& swarrow & downarrow & searrow & \
5 & & 4 & & 3
endarray
$$
This means that the big number represents the following pattern of directions:
$$
[rightarrow, rightarrow, searrow, rightarrow, searrow, downarrow, downarrow, swarrow, leftarrow, swarrow, leftarrow, leftarrow, leftarrow, leftarrow, leftarrow, nwarrow, leftarrow, nwarrow, uparrow, uparrow, nearrow, rightarrow, nearrow, rightarrow, rightarrow]
$$
With this signature context, the canvas iterates through the $textttpattern$ list and writes $textttlength$ characters from the $textttfiller$ in the current direction.
The $textttlength$ is specified in the code as $2$ (at the beginning of the code). For the $textttfiller$, we need a rotated version of the alphabet such that it starts with the given input. That is done with the following code (try it here):
AA¹k._
A¹k # Find the <index> of the given input character in the alphabet
A ._ # Rotate the alphabet to the left <index> times.
In pseudocode, this would be executed by the canvas function:
$
beginarrayl
1. & textWrite colorbluetextttab text in the direction rightarrow \
2. & textWrite colorbluetextttbc text in the direction rightarrow \
3. & textWrite colorbluetextttcd text in the direction searrow \
4. & textWrite colorbluetextttde text in the direction rightarrow \
5. & textWrite colorbluetextttef text in the direction searrow \
6. & textWrite colorbluetextttfg text in the direction downarrow \
dots
endarray
$
Lastly, you can see that the filler argument is 'rotated' $textttlength - 1$ times to the right, meaning that the canvas would iterate through the following (cycled and therefore infinite) list:
$$
[colorbluetextttab, colorbluetextttbc, colorbluetextttcd, colorbluetextttde, colorbluetextttef, colorbluetextttfg, colorbluetextttgh, colorbluetexttthi, colorbluetextttij, colorbluetextttjk, ...
$$
Which results in the desired alphabet soup ascii-art shape.
$endgroup$
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.AA¹k._can alternatively beA¹¡RJ«, but it's the same byte-count.•1못*Ć,ãiDΣ•can alternatively be•õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!
$endgroup$
– Kevin Cruijssen
10 hours ago
add a comment |
$begingroup$
05AB1E, 21 bytes
Defines a program $f : colorpurpletextttAlphabeticChar rightarrow colorpurpletextttString$
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
Breakdown:
2AA¹k._•1못*Ć,ãiDΣ•Λ
2 # <length>
AA¹k._ # <filler>
•1못*Ć,ãiDΣ• # <pattern>
Λ # Invoke the canvas function.
Explanation:
The canvas (Λ) in this particular context works as a function with the following signature:
$$
mathsfLambda : left(textttlength: colorpurpletextttNat, textttfiller: colorpurpletextttString, textttpattern: colorpurpletextttNatright) rightarrow colorpurpletextttString
$$
The $textttpattern$ parameter is in this situation a number defining the directions. In the code, this number is represented as •1못*Ć,ãiDΣ•, which is a compressed version of the big number $2232344565666667670012122$. Directions are denoted in the following manner:
$$
beginarrayl
7 & & 0 & & 1 \
& nwarrow & uparrow & nearrow & \
6 & leftarrow & bullet & rightarrow & 2 \
& swarrow & downarrow & searrow & \
5 & & 4 & & 3
endarray
$$
This means that the big number represents the following pattern of directions:
$$
[rightarrow, rightarrow, searrow, rightarrow, searrow, downarrow, downarrow, swarrow, leftarrow, swarrow, leftarrow, leftarrow, leftarrow, leftarrow, leftarrow, nwarrow, leftarrow, nwarrow, uparrow, uparrow, nearrow, rightarrow, nearrow, rightarrow, rightarrow]
$$
With this signature context, the canvas iterates through the $textttpattern$ list and writes $textttlength$ characters from the $textttfiller$ in the current direction.
The $textttlength$ is specified in the code as $2$ (at the beginning of the code). For the $textttfiller$, we need a rotated version of the alphabet such that it starts with the given input. That is done with the following code (try it here):
AA¹k._
A¹k # Find the <index> of the given input character in the alphabet
A ._ # Rotate the alphabet to the left <index> times.
In pseudocode, this would be executed by the canvas function:
$
beginarrayl
1. & textWrite colorbluetextttab text in the direction rightarrow \
2. & textWrite colorbluetextttbc text in the direction rightarrow \
3. & textWrite colorbluetextttcd text in the direction searrow \
4. & textWrite colorbluetextttde text in the direction rightarrow \
5. & textWrite colorbluetextttef text in the direction searrow \
6. & textWrite colorbluetextttfg text in the direction downarrow \
dots
endarray
$
Lastly, you can see that the filler argument is 'rotated' $textttlength - 1$ times to the right, meaning that the canvas would iterate through the following (cycled and therefore infinite) list:
$$
[colorbluetextttab, colorbluetextttbc, colorbluetextttcd, colorbluetextttde, colorbluetextttef, colorbluetextttfg, colorbluetextttgh, colorbluetexttthi, colorbluetextttij, colorbluetextttjk, ...
$$
Which results in the desired alphabet soup ascii-art shape.
$endgroup$
05AB1E, 21 bytes
Defines a program $f : colorpurpletextttAlphabeticChar rightarrow colorpurpletextttString$
Code:
2AA¹k._•1못*Ć,ãiDΣ•Λ
Try it online!
Breakdown:
2AA¹k._•1못*Ć,ãiDΣ•Λ
2 # <length>
AA¹k._ # <filler>
•1못*Ć,ãiDΣ• # <pattern>
Λ # Invoke the canvas function.
Explanation:
The canvas (Λ) in this particular context works as a function with the following signature:
$$
mathsfLambda : left(textttlength: colorpurpletextttNat, textttfiller: colorpurpletextttString, textttpattern: colorpurpletextttNatright) rightarrow colorpurpletextttString
$$
The $textttpattern$ parameter is in this situation a number defining the directions. In the code, this number is represented as •1못*Ć,ãiDΣ•, which is a compressed version of the big number $2232344565666667670012122$. Directions are denoted in the following manner:
$$
beginarrayl
7 & & 0 & & 1 \
& nwarrow & uparrow & nearrow & \
6 & leftarrow & bullet & rightarrow & 2 \
& swarrow & downarrow & searrow & \
5 & & 4 & & 3
endarray
$$
This means that the big number represents the following pattern of directions:
$$
[rightarrow, rightarrow, searrow, rightarrow, searrow, downarrow, downarrow, swarrow, leftarrow, swarrow, leftarrow, leftarrow, leftarrow, leftarrow, leftarrow, nwarrow, leftarrow, nwarrow, uparrow, uparrow, nearrow, rightarrow, nearrow, rightarrow, rightarrow]
$$
With this signature context, the canvas iterates through the $textttpattern$ list and writes $textttlength$ characters from the $textttfiller$ in the current direction.
The $textttlength$ is specified in the code as $2$ (at the beginning of the code). For the $textttfiller$, we need a rotated version of the alphabet such that it starts with the given input. That is done with the following code (try it here):
AA¹k._
A¹k # Find the <index> of the given input character in the alphabet
A ._ # Rotate the alphabet to the left <index> times.
In pseudocode, this would be executed by the canvas function:
$
beginarrayl
1. & textWrite colorbluetextttab text in the direction rightarrow \
2. & textWrite colorbluetextttbc text in the direction rightarrow \
3. & textWrite colorbluetextttcd text in the direction searrow \
4. & textWrite colorbluetextttde text in the direction rightarrow \
5. & textWrite colorbluetextttef text in the direction searrow \
6. & textWrite colorbluetextttfg text in the direction downarrow \
dots
endarray
$
Lastly, you can see that the filler argument is 'rotated' $textttlength - 1$ times to the right, meaning that the canvas would iterate through the following (cycled and therefore infinite) list:
$$
[colorbluetextttab, colorbluetextttbc, colorbluetextttcd, colorbluetextttde, colorbluetextttef, colorbluetextttfg, colorbluetextttgh, colorbluetexttthi, colorbluetextttij, colorbluetextttjk, ...
$$
Which results in the desired alphabet soup ascii-art shape.
edited 13 hours ago
answered yesterday
AdnanAdnan
35.8k562226
35.8k562226
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.AA¹k._can alternatively beA¹¡RJ«, but it's the same byte-count.•1못*Ć,ãiDΣ•can alternatively be•õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!
$endgroup$
– Kevin Cruijssen
10 hours ago
add a comment |
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.AA¹k._can alternatively beA¹¡RJ«, but it's the same byte-count.•1못*Ć,ãiDΣ•can alternatively be•õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!
$endgroup$
– Kevin Cruijssen
10 hours ago
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.
AA¹k._ can alternatively be A¹¡RJ«, but it's the same byte-count. •1못*Ć,ãiDΣ• can alternatively be •õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!$endgroup$
– Kevin Cruijssen
10 hours ago
$begingroup$
Ok, I give up. Tried to find shorter alternatives, but I'm not seeing it.
AA¹k._ can alternatively be A¹¡RJ«, but it's the same byte-count. •1못*Ć,ãiDΣ• can alternatively be •õÕ₆qηµñ–†f•·, but it's the same byte-count. Ah well. Nice answer!$endgroup$
– Kevin Cruijssen
10 hours ago
add a comment |
$begingroup$
Perl 6, 100 bytes
"2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK".trans(/S/=>(try ' 'x$/+1))
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))
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))
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))
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 22 hours ago
answered 22 hours ago
Jo KingJo King
25.1k359128
25.1k359128
add a comment |
add a comment |
$begingroup$
Ruby, 107 bytes
->na=(0..6).map' '*11
(?A..?Z).mapi
a*$/
Try it online!
Improved syntax "i".to_c -> 1i (Suggested by Jordan)
Changed coordinate system so 0 degrees is at right instead of top. This enables 0.5 -> 6
Adjusted multipliers of j and k for shortness
Rather than print output puts a, concatenate array elements and return a string a*$/
Ruby, 119 bytes
->na=(0..6).map' '*11
(?A..?Z).map
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$
$begingroup$
Instead of"i".to_ccan you just do1i?
$endgroup$
– Jordan
8 hours ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour ago
add a comment |
$begingroup$
Ruby, 107 bytes
->na=(0..6).map' '*11
(?A..?Z).mapi
a*$/
Try it online!
Improved syntax "i".to_c -> 1i (Suggested by Jordan)
Changed coordinate system so 0 degrees is at right instead of top. This enables 0.5 -> 6
Adjusted multipliers of j and k for shortness
Rather than print output puts a, concatenate array elements and return a string a*$/
Ruby, 119 bytes
->na=(0..6).map' '*11
(?A..?Z).map
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$
$begingroup$
Instead of"i".to_ccan you just do1i?
$endgroup$
– Jordan
8 hours ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour ago
add a comment |
$begingroup$
Ruby, 107 bytes
->na=(0..6).map' '*11
(?A..?Z).mapi
a*$/
Try it online!
Improved syntax "i".to_c -> 1i (Suggested by Jordan)
Changed coordinate system so 0 degrees is at right instead of top. This enables 0.5 -> 6
Adjusted multipliers of j and k for shortness
Rather than print output puts a, concatenate array elements and return a string a*$/
Ruby, 119 bytes
->na=(0..6).map' '*11
(?A..?Z).map
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, 107 bytes
->na=(0..6).map' '*11
(?A..?Z).mapi
a*$/
Try it online!
Improved syntax "i".to_c -> 1i (Suggested by Jordan)
Changed coordinate system so 0 degrees is at right instead of top. This enables 0.5 -> 6
Adjusted multipliers of j and k for shortness
Rather than print output puts a, concatenate array elements and return a string a*$/
Ruby, 119 bytes
->na=(0..6).map' '*11
(?A..?Z).map
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!
edited 1 hour ago
answered 23 hours ago
Level River StLevel River St
20.4k32680
20.4k32680
$begingroup$
Instead of"i".to_ccan you just do1i?
$endgroup$
– Jordan
8 hours ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour ago
add a comment |
$begingroup$
Instead of"i".to_ccan you just do1i?
$endgroup$
– Jordan
8 hours ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour ago
$begingroup$
Instead of
"i".to_c can you just do 1i?$endgroup$
– Jordan
8 hours ago
$begingroup$
Instead of
"i".to_c can you just do 1i?$endgroup$
– Jordan
8 hours ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour ago
$begingroup$
@Jordan thanks, I've not seen that syntax before!
$endgroup$
– Level River St
1 hour 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
yesterday
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
yesterday
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 yesterday
answered yesterday
Luis MendoLuis Mendo
74.9k888291
74.9k888291
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
yesterday
add a comment |
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
yesterday
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
yesterday
$begingroup$
Um... what does the arctan do? Anything with the slightly circular shape? ;-)
$endgroup$
– Erik the Outgolfer
yesterday
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 23 hours ago
NeilNeil
81.9k745178
81.9k745178
add a comment |
add a comment |
$begingroup$
JavaScript (Node.js), 121 119 bytes
Saved 2 bytes thanks to @tsh
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>''.padEnd(+x+1)||(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
How?
This code abuses Buffer to extract the ASCII codes of the template letter $x$ and input letter $c$ and convert them back into the target letter.
Example with $c=$"H" and $x=$"B"
// extracting the ASCII codes
Buffer(c + x) → Buffer("HB") → <Buffer 48 42>
// assigning them to variables
[a, b] = Buffer(c + x) → a = 0x48 (72) and b = 0x42 (66)
// computing the ASCII code of the target letter
65 + ((a + b) % 26) → 65 + (138 % 26) → 65 + 8 → 73
// turning it back into a character
Buffer([73]) → <Buffer 49> → implicitly coerced to "I" by replace()
$endgroup$
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
add a comment |
$begingroup$
JavaScript (Node.js), 121 119 bytes
Saved 2 bytes thanks to @tsh
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>''.padEnd(+x+1)||(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
How?
This code abuses Buffer to extract the ASCII codes of the template letter $x$ and input letter $c$ and convert them back into the target letter.
Example with $c=$"H" and $x=$"B"
// extracting the ASCII codes
Buffer(c + x) → Buffer("HB") → <Buffer 48 42>
// assigning them to variables
[a, b] = Buffer(c + x) → a = 0x48 (72) and b = 0x42 (66)
// computing the ASCII code of the target letter
65 + ((a + b) % 26) → 65 + (138 % 26) → 65 + 8 → 73
// turning it back into a character
Buffer([73]) → <Buffer 49> → implicitly coerced to "I" by replace()
$endgroup$
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
add a comment |
$begingroup$
JavaScript (Node.js), 121 119 bytes
Saved 2 bytes thanks to @tsh
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>''.padEnd(+x+1)||(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
How?
This code abuses Buffer to extract the ASCII codes of the template letter $x$ and input letter $c$ and convert them back into the target letter.
Example with $c=$"H" and $x=$"B"
// extracting the ASCII codes
Buffer(c + x) → Buffer("HB") → <Buffer 48 42>
// assigning them to variables
[a, b] = Buffer(c + x) → a = 0x48 (72) and b = 0x42 (66)
// computing the ASCII code of the target letter
65 + ((a + b) % 26) → 65 + (138 % 26) → 65 + 8 → 73
// turning it back into a character
Buffer([73]) → <Buffer 49> → implicitly coerced to "I" by replace()
$endgroup$
JavaScript (Node.js), 121 119 bytes
Saved 2 bytes thanks to @tsh
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>''.padEnd(+x+1)||(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))
Try it online!
How?
This code abuses Buffer to extract the ASCII codes of the template letter $x$ and input letter $c$ and convert them back into the target letter.
Example with $c=$"H" and $x=$"B"
// extracting the ASCII codes
Buffer(c + x) → Buffer("HB") → <Buffer 48 42>
// assigning them to variables
[a, b] = Buffer(c + x) → a = 0x48 (72) and b = 0x42 (66)
// computing the ASCII code of the target letter
65 + ((a + b) % 26) → 65 + (138 % 26) → 65 + 8 → 73
// turning it back into a character
Buffer([73]) → <Buffer 49> → implicitly coerced to "I" by replace()
edited 10 hours ago
answered yesterday
ArnauldArnauld
79.4k796330
79.4k796330
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
add a comment |
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
$begingroup$
119 bytes
$endgroup$
– tsh
17 hours ago
add a comment |
$begingroup$
R, 139 122 bytes
-17 bytes thanks to Giuseppe
u=utf8ToInt;`*`=rep;o=c(' '*12,'
')*7;o[u(" &3@LKWVUTSRDC5(")]=LETTERS[(13:38+u(scan(,'')))%%26+1];cat(o,sep='')
Explanation:
o=rep(c(rep(' ',12),'
'),7)
Builds an empty box of spaces
u(" &3@LKWVUTSRDC5(")
is a set of indices for letter positions corresponding to:
c(7:9,23,24,38,51,64,76,75,87:82,68,67,53,40,27,15,16,4:6)
TIO
$endgroup$
1
$begingroup$
you never useintToUtf8so those are extraneous bytes, but if you use*in place ofrep, you can get save 2 bytes and get to 125 bytes
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the-32, for 122 bytes. You can generate them yourself by usingcat(intToUtf8(bytes)).
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed theintToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks
$endgroup$
– Aaron Hayman
2 hours ago
add a comment |
$begingroup$
R, 139 122 bytes
-17 bytes thanks to Giuseppe
u=utf8ToInt;`*`=rep;o=c(' '*12,'
')*7;o[u(" &3@LKWVUTSRDC5(")]=LETTERS[(13:38+u(scan(,'')))%%26+1];cat(o,sep='')
Explanation:
o=rep(c(rep(' ',12),'
'),7)
Builds an empty box of spaces
u(" &3@LKWVUTSRDC5(")
is a set of indices for letter positions corresponding to:
c(7:9,23,24,38,51,64,76,75,87:82,68,67,53,40,27,15,16,4:6)
TIO
$endgroup$
1
$begingroup$
you never useintToUtf8so those are extraneous bytes, but if you use*in place ofrep, you can get save 2 bytes and get to 125 bytes
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the-32, for 122 bytes. You can generate them yourself by usingcat(intToUtf8(bytes)).
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed theintToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks
$endgroup$
– Aaron Hayman
2 hours ago
add a comment |
$begingroup$
R, 139 122 bytes
-17 bytes thanks to Giuseppe
u=utf8ToInt;`*`=rep;o=c(' '*12,'
')*7;o[u(" &3@LKWVUTSRDC5(")]=LETTERS[(13:38+u(scan(,'')))%%26+1];cat(o,sep='')
Explanation:
o=rep(c(rep(' ',12),'
'),7)
Builds an empty box of spaces
u(" &3@LKWVUTSRDC5(")
is a set of indices for letter positions corresponding to:
c(7:9,23,24,38,51,64,76,75,87:82,68,67,53,40,27,15,16,4:6)
TIO
$endgroup$
R, 139 122 bytes
-17 bytes thanks to Giuseppe
u=utf8ToInt;`*`=rep;o=c(' '*12,'
')*7;o[u(" &3@LKWVUTSRDC5(")]=LETTERS[(13:38+u(scan(,'')))%%26+1];cat(o,sep='')
Explanation:
o=rep(c(rep(' ',12),'
'),7)
Builds an empty box of spaces
u(" &3@LKWVUTSRDC5(")
is a set of indices for letter positions corresponding to:
c(7:9,23,24,38,51,64,76,75,87:82,68,67,53,40,27,15,16,4:6)
TIO
edited 2 hours ago
answered 5 hours ago
Aaron HaymanAaron Hayman
2615
2615
1
$begingroup$
you never useintToUtf8so those are extraneous bytes, but if you use*in place ofrep, you can get save 2 bytes and get to 125 bytes
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the-32, for 122 bytes. You can generate them yourself by usingcat(intToUtf8(bytes)).
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed theintToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks
$endgroup$
– Aaron Hayman
2 hours ago
add a comment |
1
$begingroup$
you never useintToUtf8so those are extraneous bytes, but if you use*in place ofrep, you can get save 2 bytes and get to 125 bytes
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the-32, for 122 bytes. You can generate them yourself by usingcat(intToUtf8(bytes)).
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed theintToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks
$endgroup$
– Aaron Hayman
2 hours ago
1
1
$begingroup$
you never use
intToUtf8 so those are extraneous bytes, but if you use * in place of rep, you can get save 2 bytes and get to 125 bytes$endgroup$
– Giuseppe
5 hours ago
$begingroup$
you never use
intToUtf8 so those are extraneous bytes, but if you use * in place of rep, you can get save 2 bytes and get to 125 bytes$endgroup$
– Giuseppe
5 hours ago
1
1
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the
-32, for 122 bytes. You can generate them yourself by using cat(intToUtf8(bytes)).$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Oh, and using the low-byte characters instead of printable ascii you can shave off the
-32, for 122 bytes. You can generate them yourself by using cat(intToUtf8(bytes)).$endgroup$
– Giuseppe
5 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed the
intToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks$endgroup$
– Aaron Hayman
2 hours ago
$begingroup$
@Giuseppe I was pretty sure I had already removed the
intToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks$endgroup$
– Aaron Hayman
2 hours ago
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 yesterday
Erik the OutgolferErik the Outgolfer
32.6k429105
32.6k429105
add a comment |
add a comment |
$begingroup$
R, 218 197 bytes
-21 bytes thanks to Giuseppe
function(t,l=letters,`*`=rep,s=" ",n="
",`~`=`[`,r=c(l~l>=t,l))cat(s*3,r~24:26,r~1:3,n,s,r~22:23,q<-s*6,r~4:5,n,r~21,u<-s*10,r~6,n,r~20,u,r~7,n,r~19,u,r~8,n,s,r~17:18,q,r~10:9,n,s*3,r~16:11,sep='')
Try it online!
Ungolfed:
alphasoup <- function(startlet)
startnum <- which(l == startlet)
rotatedletters <- c(letters[startnum:26], letters[1:(startnum -1)])[1:26]
cat(' ',rotatedletters[24:26],rotatedletters[1:3], 'n ',
rotatedletters[22:23], s6 <- ' ', rotatedletters[4:5], 'n',
rotatedletters[21], s10 <- rep(' ', 10), rotatedletters[6], 'n',
rotatedletters[20], s10, rotatedletters[7], 'n',
rotatedletters[19], s10, rotatedletters[8], 'n ',
rotatedletters[17:18], s6, rotatedletters[10:9], 'n ',
rotatedletters[16:11],
sep = '')
Created rotated letter vector and uses cat to fill out rim of bowl with that vector.
$endgroup$
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing thewhichand usingl>=tas the index directly, which was worth 12 bytes.
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
198 bytes by aliasing[with~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
add a comment |
$begingroup$
R, 218 197 bytes
-21 bytes thanks to Giuseppe
function(t,l=letters,`*`=rep,s=" ",n="
",`~`=`[`,r=c(l~l>=t,l))cat(s*3,r~24:26,r~1:3,n,s,r~22:23,q<-s*6,r~4:5,n,r~21,u<-s*10,r~6,n,r~20,u,r~7,n,r~19,u,r~8,n,s,r~17:18,q,r~10:9,n,s*3,r~16:11,sep='')
Try it online!
Ungolfed:
alphasoup <- function(startlet)
startnum <- which(l == startlet)
rotatedletters <- c(letters[startnum:26], letters[1:(startnum -1)])[1:26]
cat(' ',rotatedletters[24:26],rotatedletters[1:3], 'n ',
rotatedletters[22:23], s6 <- ' ', rotatedletters[4:5], 'n',
rotatedletters[21], s10 <- rep(' ', 10), rotatedletters[6], 'n',
rotatedletters[20], s10, rotatedletters[7], 'n',
rotatedletters[19], s10, rotatedletters[8], 'n ',
rotatedletters[17:18], s6, rotatedletters[10:9], 'n ',
rotatedletters[16:11],
sep = '')
Created rotated letter vector and uses cat to fill out rim of bowl with that vector.
$endgroup$
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing thewhichand usingl>=tas the index directly, which was worth 12 bytes.
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
198 bytes by aliasing[with~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
add a comment |
$begingroup$
R, 218 197 bytes
-21 bytes thanks to Giuseppe
function(t,l=letters,`*`=rep,s=" ",n="
",`~`=`[`,r=c(l~l>=t,l))cat(s*3,r~24:26,r~1:3,n,s,r~22:23,q<-s*6,r~4:5,n,r~21,u<-s*10,r~6,n,r~20,u,r~7,n,r~19,u,r~8,n,s,r~17:18,q,r~10:9,n,s*3,r~16:11,sep='')
Try it online!
Ungolfed:
alphasoup <- function(startlet)
startnum <- which(l == startlet)
rotatedletters <- c(letters[startnum:26], letters[1:(startnum -1)])[1:26]
cat(' ',rotatedletters[24:26],rotatedletters[1:3], 'n ',
rotatedletters[22:23], s6 <- ' ', rotatedletters[4:5], 'n',
rotatedletters[21], s10 <- rep(' ', 10), rotatedletters[6], 'n',
rotatedletters[20], s10, rotatedletters[7], 'n',
rotatedletters[19], s10, rotatedletters[8], 'n ',
rotatedletters[17:18], s6, rotatedletters[10:9], 'n ',
rotatedletters[16:11],
sep = '')
Created rotated letter vector and uses cat to fill out rim of bowl with that vector.
$endgroup$
R, 218 197 bytes
-21 bytes thanks to Giuseppe
function(t,l=letters,`*`=rep,s=" ",n="
",`~`=`[`,r=c(l~l>=t,l))cat(s*3,r~24:26,r~1:3,n,s,r~22:23,q<-s*6,r~4:5,n,r~21,u<-s*10,r~6,n,r~20,u,r~7,n,r~19,u,r~8,n,s,r~17:18,q,r~10:9,n,s*3,r~16:11,sep='')
Try it online!
Ungolfed:
alphasoup <- function(startlet)
startnum <- which(l == startlet)
rotatedletters <- c(letters[startnum:26], letters[1:(startnum -1)])[1:26]
cat(' ',rotatedletters[24:26],rotatedletters[1:3], 'n ',
rotatedletters[22:23], s6 <- ' ', rotatedletters[4:5], 'n',
rotatedletters[21], s10 <- rep(' ', 10), rotatedletters[6], 'n',
rotatedletters[20], s10, rotatedletters[7], 'n',
rotatedletters[19], s10, rotatedletters[8], 'n ',
rotatedletters[17:18], s6, rotatedletters[10:9], 'n ',
rotatedletters[16:11],
sep = '')
Created rotated letter vector and uses cat to fill out rim of bowl with that vector.
edited 5 hours ago
answered 8 hours ago
CT HallCT Hall
44110
44110
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing thewhichand usingl>=tas the index directly, which was worth 12 bytes.
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
198 bytes by aliasing[with~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
add a comment |
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing thewhichand usingl>=tas the index directly, which was worth 12 bytes.
$endgroup$
– Giuseppe
5 hours ago
1
$begingroup$
198 bytes by aliasing[with~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.
$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing the
which and using l>=t as the index directly, which was worth 12 bytes.$endgroup$
– Giuseppe
5 hours ago
$begingroup$
203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing the
which and using l>=t as the index directly, which was worth 12 bytes.$endgroup$
– Giuseppe
5 hours ago
1
1
$begingroup$
198 bytes by aliasing
[ with ~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.$endgroup$
– Giuseppe
5 hours ago
$begingroup$
198 bytes by aliasing
[ with ~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.$endgroup$
– Giuseppe
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
$begingroup$
Ah, that's clever, I forget about string comparisons.
$endgroup$
– CT Hall
5 hours ago
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 yesterday
J42161217J42161217
13.3k21251
13.3k21251
add a comment |
add a comment |
$begingroup$
APL+WIN, 72 bytes
Prompts for character
m←7 12⍴' '⋄n←(7⍴2)⊤v,⌽v←(⍳3)/28 34 65⋄((,n)/,m)←(22+s⍳⎕)⌽s←⎕av[65+⍳26]⋄m
Try it online!Coutesy of Dyalog Classic
$endgroup$
add a comment |
$begingroup$
APL+WIN, 72 bytes
Prompts for character
m←7 12⍴' '⋄n←(7⍴2)⊤v,⌽v←(⍳3)/28 34 65⋄((,n)/,m)←(22+s⍳⎕)⌽s←⎕av[65+⍳26]⋄m
Try it online!Coutesy of Dyalog Classic
$endgroup$
add a comment |
$begingroup$
APL+WIN, 72 bytes
Prompts for character
m←7 12⍴' '⋄n←(7⍴2)⊤v,⌽v←(⍳3)/28 34 65⋄((,n)/,m)←(22+s⍳⎕)⌽s←⎕av[65+⍳26]⋄m
Try it online!Coutesy of Dyalog Classic
$endgroup$
APL+WIN, 72 bytes
Prompts for character
m←7 12⍴' '⋄n←(7⍴2)⊤v,⌽v←(⍳3)/28 34 65⋄((,n)/,m)←(22+s⍳⎕)⌽s←⎕av[65+⍳26]⋄m
Try it online!Coutesy of Dyalog Classic
answered 16 hours ago
GrahamGraham
2,58678
2,58678
add a comment |
add a comment |
$begingroup$
Red, 139 bytes
func[a][foreach c XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK[if c > sp[c: c + a % 26 + 65]prin c]]
Try it online!
A really naive solution.
$endgroup$
add a comment |
$begingroup$
Red, 139 bytes
func[a][foreach c XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK[if c > sp[c: c + a % 26 + 65]prin c]]
Try it online!
A really naive solution.
$endgroup$
add a comment |
$begingroup$
Red, 139 bytes
func[a][foreach c XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK[if c > sp[c: c + a % 26 + 65]prin c]]
Try it online!
A really naive solution.
$endgroup$
Red, 139 bytes
func[a][foreach c XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK[if c > sp[c: c + a % 26 + 65]prin c]]
Try it online!
A really naive solution.
edited 11 hours ago
answered 11 hours ago
Galen IvanovGalen Ivanov
7,17211034
7,17211034
add a comment |
add a comment |
$begingroup$
TSQL query, 240 bytes
DECLARE @y char='G'
,@ char(91)='';WITH C as(SELECT 7a,'5585877636333330301122555'z,ascii(@y)x
UNION ALL
SELECT a+left(z,1)/3*13+left(z,1)%3-14,stuff(z,1,1,''),(x+14)%26+65FROM
C WHERE''<z)SELECT
@=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))FROM
C PRINT @
The output starts with a blank line.
The long list of numbers represents directions.
I would have made a try it out link, but the site was messing up the output. Hopefully some nice person, will verify that this works in SQL Server Management Studio.
$endgroup$
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
add a comment |
$begingroup$
TSQL query, 240 bytes
DECLARE @y char='G'
,@ char(91)='';WITH C as(SELECT 7a,'5585877636333330301122555'z,ascii(@y)x
UNION ALL
SELECT a+left(z,1)/3*13+left(z,1)%3-14,stuff(z,1,1,''),(x+14)%26+65FROM
C WHERE''<z)SELECT
@=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))FROM
C PRINT @
The output starts with a blank line.
The long list of numbers represents directions.
I would have made a try it out link, but the site was messing up the output. Hopefully some nice person, will verify that this works in SQL Server Management Studio.
$endgroup$
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
add a comment |
$begingroup$
TSQL query, 240 bytes
DECLARE @y char='G'
,@ char(91)='';WITH C as(SELECT 7a,'5585877636333330301122555'z,ascii(@y)x
UNION ALL
SELECT a+left(z,1)/3*13+left(z,1)%3-14,stuff(z,1,1,''),(x+14)%26+65FROM
C WHERE''<z)SELECT
@=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))FROM
C PRINT @
The output starts with a blank line.
The long list of numbers represents directions.
I would have made a try it out link, but the site was messing up the output. Hopefully some nice person, will verify that this works in SQL Server Management Studio.
$endgroup$
TSQL query, 240 bytes
DECLARE @y char='G'
,@ char(91)='';WITH C as(SELECT 7a,'5585877636333330301122555'z,ascii(@y)x
UNION ALL
SELECT a+left(z,1)/3*13+left(z,1)%3-14,stuff(z,1,1,''),(x+14)%26+65FROM
C WHERE''<z)SELECT
@=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))FROM
C PRINT @
The output starts with a blank line.
The long list of numbers represents directions.
I would have made a try it out link, but the site was messing up the output. Hopefully some nice person, will verify that this works in SQL Server Management Studio.
edited 4 hours ago
answered 9 hours ago
t-clausen.dkt-clausen.dk
1,944314
1,944314
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
add a comment |
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
unfortunately it looks like it is slightly out. The first line has seven characters in it rather than 6 and the second line has a single char and double char instead of 2 double chars. If you drop the first char of the first line down a line and rotate by one more you should be right.
$endgroup$
– MickyT
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
$begingroup$
@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db
$endgroup$
– t-clausen.dk
5 hours ago
add a comment |
$begingroup$
Perl 5 -p, 110 bytes
$b=/A/?Z:chr(-1+ord);$_=eval("'2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK'=~y/A-Z/$_-ZA-$b/r");s/d/$".$"x$&/eg
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -p, 110 bytes
$b=/A/?Z:chr(-1+ord);$_=eval("'2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK'=~y/A-Z/$_-ZA-$b/r");s/d/$".$"x$&/eg
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -p, 110 bytes
$b=/A/?Z:chr(-1+ord);$_=eval("'2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK'=~y/A-Z/$_-ZA-$b/r");s/d/$".$"x$&/eg
Try it online!
$endgroup$
Perl 5 -p, 110 bytes
$b=/A/?Z:chr(-1+ord);$_=eval("'2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK'=~y/A-Z/$_-ZA-$b/r");s/d/$".$"x$&/eg
Try it online!
answered 3 hours ago
XcaliXcali
5,445520
5,445520
add a comment |
add a comment |
$begingroup$
Kotlin, 148 bytes
l:Char->"""2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK""".mapc->if(c>'@')(((c-'A')+(l-'A'))%26+65).toChar()
else if(c>' ')" ".repeat(c-'/')
else c
Try it online!
$endgroup$
add a comment |
$begingroup$
Kotlin, 148 bytes
l:Char->"""2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK""".mapc->if(c>'@')(((c-'A')+(l-'A'))%26+65).toChar()
else if(c>' ')" ".repeat(c-'/')
else c
Try it online!
$endgroup$
add a comment |
$begingroup$
Kotlin, 148 bytes
l:Char->"""2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK""".mapc->if(c>'@')(((c-'A')+(l-'A'))%26+65).toChar()
else if(c>' ')" ".repeat(c-'/')
else c
Try it online!
$endgroup$
Kotlin, 148 bytes
l:Char->"""2XYZABC
VW5DE
U9F
T9G
S9H
RQ5JI
2PONMLK""".mapc->if(c>'@')(((c-'A')+(l-'A'))%26+65).toChar()
else if(c>' ')" ".repeat(c-'/')
else c
Try it online!
answered 1 hour ago
JohnWellsJohnWells
5216
5216
add a comment |
add a comment |
$begingroup$
Haskell, 127 bytes
("cXYZABC aVWfDE UjF TjG SjH aRQfJI cPONMLK">>=).(?)
t?c|c>'Z'=' '<$['a'..c]|c<'!'="n"|t<'B'=[c]|c>'Y'=t?'@'|1<2=pred t?succ c
Try it online!
Each character in the encoded string is decoded by function ? into a string:
t?c -- 't' is the starting char,
-- 'c' the char from the encoded string
|c>'Z'=' '<$['a'..c] -- if 'c' is a lowercase letter, return some spaces
-- 'a': one, 'b': two, etc
|c<'!'="n" -- if 'c' is a space, return a newline
|t<'B'=[c] -- if 't' is the letter A, return 'c'
|c>'Y'=t?'@' -- wrap around Z
|1<2=pred t?succ c -- else the result is the same as starting one letter
-- earlier (pred t) but looking at the successor of 'c'
$endgroup$
add a comment |
$begingroup$
Haskell, 127 bytes
("cXYZABC aVWfDE UjF TjG SjH aRQfJI cPONMLK">>=).(?)
t?c|c>'Z'=' '<$['a'..c]|c<'!'="n"|t<'B'=[c]|c>'Y'=t?'@'|1<2=pred t?succ c
Try it online!
Each character in the encoded string is decoded by function ? into a string:
t?c -- 't' is the starting char,
-- 'c' the char from the encoded string
|c>'Z'=' '<$['a'..c] -- if 'c' is a lowercase letter, return some spaces
-- 'a': one, 'b': two, etc
|c<'!'="n" -- if 'c' is a space, return a newline
|t<'B'=[c] -- if 't' is the letter A, return 'c'
|c>'Y'=t?'@' -- wrap around Z
|1<2=pred t?succ c -- else the result is the same as starting one letter
-- earlier (pred t) but looking at the successor of 'c'
$endgroup$
add a comment |
$begingroup$
Haskell, 127 bytes
("cXYZABC aVWfDE UjF TjG SjH aRQfJI cPONMLK">>=).(?)
t?c|c>'Z'=' '<$['a'..c]|c<'!'="n"|t<'B'=[c]|c>'Y'=t?'@'|1<2=pred t?succ c
Try it online!
Each character in the encoded string is decoded by function ? into a string:
t?c -- 't' is the starting char,
-- 'c' the char from the encoded string
|c>'Z'=' '<$['a'..c] -- if 'c' is a lowercase letter, return some spaces
-- 'a': one, 'b': two, etc
|c<'!'="n" -- if 'c' is a space, return a newline
|t<'B'=[c] -- if 't' is the letter A, return 'c'
|c>'Y'=t?'@' -- wrap around Z
|1<2=pred t?succ c -- else the result is the same as starting one letter
-- earlier (pred t) but looking at the successor of 'c'
$endgroup$
Haskell, 127 bytes
("cXYZABC aVWfDE UjF TjG SjH aRQfJI cPONMLK">>=).(?)
t?c|c>'Z'=' '<$['a'..c]|c<'!'="n"|t<'B'=[c]|c>'Y'=t?'@'|1<2=pred t?succ c
Try it online!
Each character in the encoded string is decoded by function ? into a string:
t?c -- 't' is the starting char,
-- 'c' the char from the encoded string
|c>'Z'=' '<$['a'..c] -- if 'c' is a lowercase letter, return some spaces
-- 'a': one, 'b': two, etc
|c<'!'="n" -- if 'c' is a space, return a newline
|t<'B'=[c] -- if 't' is the letter A, return 'c'
|c>'Y'=t?'@' -- wrap around Z
|1<2=pred t?succ c -- else the result is the same as starting one letter
-- earlier (pred t) but looking at the successor of 'c'
answered 1 hour ago
niminimi
32.4k32389
32.4k32389
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
11
$begingroup$
Great challenge! It initially seems easy, but it's not
$endgroup$
– Luis Mendo
yesterday