C4_4 Reflection!The Characters in the String Go Round and RoundASCII Doodling: Laser in a BoxRotate a Chinese checkerboardASCII art reflectionSimulate a Rubik's cubeHexaGolf: RotatagonsSame length, different stringBinary tree rotationsRotate ASCII Art by 45 DegreesIs this skew symmetry?
A demigod among men
'Kukhtarev's model' or 'THE Kukhtarev's model'?
Can't make a xubuntu persistent live USB
Does Australia produce unique 'specialty steel'?
How can demon technology be prevented from surpassing humans?
Can the bass be used instead of drums?
"Dear Stack Exchange, I am very disappointed in you" - How to construct a strong opening line in a letter?
How can I attach a set of five panniers?
Could Alpha Centauri be made of anti-matter?
Did smallpox emerge in 1580?
What's the most efficient way to draw this region?
An idiomatic word for "very little" in this context?
How to handle shared mortgage payment if one person can't pay their share?
What does "drop" mean in this context?
How can AnyDVD destroy a DVD drive?
How did Ron get five hundred Chocolate Frog cards?
How honest to be with US immigration about uncertainty about travel plans?
Fantasy novel/series with young man who discovers he can use magic that is outlawed
First aid scissors confiscated by Dubai airport security
What causes standard door hinges to close up to a certain amount automatically?
Why is coffee provided during big chess events when it contains a banned substance?
What is the German word for: "It only works when I try to show you how it does not work"?
Can you decide not to sneak into a room after seeing your roll?
Is consistent disregard for students' time "normal" in undergraduate research?
C4_4 Reflection!
The Characters in the String Go Round and RoundASCII Doodling: Laser in a BoxRotate a Chinese checkerboardASCII art reflectionSimulate a Rubik's cubeHexaGolf: RotatagonsSame length, different stringBinary tree rotationsRotate ASCII Art by 45 DegreesIs this skew symmetry?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
$begingroup$
Sorry if this is a dupe.
In this challenge, your task is to input a rectangle ASCII pattern (You may assume only printable characters need to be handled, and you may assume a trailing newline or not), C4_4 symmetrify, and output it.
Here, C4_4 symmetric means symmetric under 90-degree rotation around a corner of the corner character. The corresponding "symmetrify" process is copy and rotate 90-degree clockwise three times, and then put all four copies together. For the precise arrangement, you can look at Test Cases.
Test Cases
Input:
asdf
jkl;
Output:
ja
ks
asdfld
jkl;;f
f;;lkj
dlfdsa
sk
aj
Input:
.O.
..O
OOO
Output:
.O.O..
..OO.O
OOOOO.
.OOOOO
O.OO..
..O.O.
code-golf ascii-art
$endgroup$
add a comment
|
$begingroup$
Sorry if this is a dupe.
In this challenge, your task is to input a rectangle ASCII pattern (You may assume only printable characters need to be handled, and you may assume a trailing newline or not), C4_4 symmetrify, and output it.
Here, C4_4 symmetric means symmetric under 90-degree rotation around a corner of the corner character. The corresponding "symmetrify" process is copy and rotate 90-degree clockwise three times, and then put all four copies together. For the precise arrangement, you can look at Test Cases.
Test Cases
Input:
asdf
jkl;
Output:
ja
ks
asdfld
jkl;;f
f;;lkj
dlfdsa
sk
aj
Input:
.O.
..O
OOO
Output:
.O.O..
..OO.O
OOOOO.
.OOOOO
O.OO..
..O.O.
code-golf ascii-art
$endgroup$
1
$begingroup$
I'd suggest to add a test case where the height of the input is strictly greater than its width.
$endgroup$
– Arnauld
11 hours ago
add a comment
|
$begingroup$
Sorry if this is a dupe.
In this challenge, your task is to input a rectangle ASCII pattern (You may assume only printable characters need to be handled, and you may assume a trailing newline or not), C4_4 symmetrify, and output it.
Here, C4_4 symmetric means symmetric under 90-degree rotation around a corner of the corner character. The corresponding "symmetrify" process is copy and rotate 90-degree clockwise three times, and then put all four copies together. For the precise arrangement, you can look at Test Cases.
Test Cases
Input:
asdf
jkl;
Output:
ja
ks
asdfld
jkl;;f
f;;lkj
dlfdsa
sk
aj
Input:
.O.
..O
OOO
Output:
.O.O..
..OO.O
OOOOO.
.OOOOO
O.OO..
..O.O.
code-golf ascii-art
$endgroup$
Sorry if this is a dupe.
In this challenge, your task is to input a rectangle ASCII pattern (You may assume only printable characters need to be handled, and you may assume a trailing newline or not), C4_4 symmetrify, and output it.
Here, C4_4 symmetric means symmetric under 90-degree rotation around a corner of the corner character. The corresponding "symmetrify" process is copy and rotate 90-degree clockwise three times, and then put all four copies together. For the precise arrangement, you can look at Test Cases.
Test Cases
Input:
asdf
jkl;
Output:
ja
ks
asdfld
jkl;;f
f;;lkj
dlfdsa
sk
aj
Input:
.O.
..O
OOO
Output:
.O.O..
..OO.O
OOOOO.
.OOOOO
O.OO..
..O.O.
code-golf ascii-art
code-golf ascii-art
edited 10 hours ago
alephalpha
22.8k3 gold badges32 silver badges98 bronze badges
22.8k3 gold badges32 silver badges98 bronze badges
asked 12 hours ago
TwilightSparkleTwilightSparkle
7374 silver badges15 bronze badges
7374 silver badges15 bronze badges
1
$begingroup$
I'd suggest to add a test case where the height of the input is strictly greater than its width.
$endgroup$
– Arnauld
11 hours ago
add a comment
|
1
$begingroup$
I'd suggest to add a test case where the height of the input is strictly greater than its width.
$endgroup$
– Arnauld
11 hours ago
1
1
$begingroup$
I'd suggest to add a test case where the height of the input is strictly greater than its width.
$endgroup$
– Arnauld
11 hours ago
$begingroup$
I'd suggest to add a test case where the height of the input is strictly greater than its width.
$endgroup$
– Arnauld
11 hours ago
add a comment
|
4 Answers
4
active
oldest
votes
$begingroup$
Charcoal, 6 bytes
A⟲C²⁴⁶
Try it online! Link is to verbose version of code. Explanation: A
implicitly prints the input, ⟲
performs the rotation, C
signifies to keep copies, and ²⁴⁶
represents the numbers of 45-degree rotations to make. (Charcoal defaults to rotating around the bottom-right corner as desired.)
$endgroup$
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
add a comment
|
$begingroup$
Python 3, 193 bytes
def f(s):q=len(s[0])-len(s);s=[[" "]*len(s[0])]*q+s;s=[[" "]*-q+l for l in s];j=lambda a,b:[x+y for x,y in zip(a,b)];r=lambda x:[*map(list,zip(*x[::-1]))];return j(s,r(s))+j(r(r(r(s))),r(r(s)))
Try it online!
$endgroup$
1
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
add a comment
|
$begingroup$
J, 38 bytes
(,|."1@|.)@(,.|:@|.)@((2$_1*>./)@${.])
Try it online!
No doubt it can be golfed much further.
$endgroup$
add a comment
|
$begingroup$
JavaScript (ES6), 178 173 bytes
Takes input as an array of strings. Returns a string.
m=>(g=x=>~y?(Y=y<w?y:W-y,X=x<w?x:W-x,Z=y<w^x<w?Y:X,(m[Z-z*d]||0)[(X^Y^Z)+!z*d]||' ')+[`
`[x-W]]+g(x<W?x+1:!y--):'')(0,w=m[0].length,h=m.length,d=w-h,(z=d>0)?0:w=h,y=W=w*2-1)
Try it online!
$endgroup$
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f193951%2fc4-4-reflection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Charcoal, 6 bytes
A⟲C²⁴⁶
Try it online! Link is to verbose version of code. Explanation: A
implicitly prints the input, ⟲
performs the rotation, C
signifies to keep copies, and ²⁴⁶
represents the numbers of 45-degree rotations to make. (Charcoal defaults to rotating around the bottom-right corner as desired.)
$endgroup$
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
add a comment
|
$begingroup$
Charcoal, 6 bytes
A⟲C²⁴⁶
Try it online! Link is to verbose version of code. Explanation: A
implicitly prints the input, ⟲
performs the rotation, C
signifies to keep copies, and ²⁴⁶
represents the numbers of 45-degree rotations to make. (Charcoal defaults to rotating around the bottom-right corner as desired.)
$endgroup$
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
add a comment
|
$begingroup$
Charcoal, 6 bytes
A⟲C²⁴⁶
Try it online! Link is to verbose version of code. Explanation: A
implicitly prints the input, ⟲
performs the rotation, C
signifies to keep copies, and ²⁴⁶
represents the numbers of 45-degree rotations to make. (Charcoal defaults to rotating around the bottom-right corner as desired.)
$endgroup$
Charcoal, 6 bytes
A⟲C²⁴⁶
Try it online! Link is to verbose version of code. Explanation: A
implicitly prints the input, ⟲
performs the rotation, C
signifies to keep copies, and ²⁴⁶
represents the numbers of 45-degree rotations to make. (Charcoal defaults to rotating around the bottom-right corner as desired.)
answered 12 hours ago
NeilNeil
89.5k8 gold badges46 silver badges188 bronze badges
89.5k8 gold badges46 silver badges188 bronze badges
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
add a comment
|
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
$begingroup$
Yet another fastest gun! Yeah, Charcoal is very suitable for this challenge. Have a +1!
$endgroup$
– TwilightSparkle
12 hours ago
add a comment
|
$begingroup$
Python 3, 193 bytes
def f(s):q=len(s[0])-len(s);s=[[" "]*len(s[0])]*q+s;s=[[" "]*-q+l for l in s];j=lambda a,b:[x+y for x,y in zip(a,b)];r=lambda x:[*map(list,zip(*x[::-1]))];return j(s,r(s))+j(r(r(r(s))),r(r(s)))
Try it online!
$endgroup$
1
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
add a comment
|
$begingroup$
Python 3, 193 bytes
def f(s):q=len(s[0])-len(s);s=[[" "]*len(s[0])]*q+s;s=[[" "]*-q+l for l in s];j=lambda a,b:[x+y for x,y in zip(a,b)];r=lambda x:[*map(list,zip(*x[::-1]))];return j(s,r(s))+j(r(r(r(s))),r(r(s)))
Try it online!
$endgroup$
1
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
add a comment
|
$begingroup$
Python 3, 193 bytes
def f(s):q=len(s[0])-len(s);s=[[" "]*len(s[0])]*q+s;s=[[" "]*-q+l for l in s];j=lambda a,b:[x+y for x,y in zip(a,b)];r=lambda x:[*map(list,zip(*x[::-1]))];return j(s,r(s))+j(r(r(r(s))),r(r(s)))
Try it online!
$endgroup$
Python 3, 193 bytes
def f(s):q=len(s[0])-len(s);s=[[" "]*len(s[0])]*q+s;s=[[" "]*-q+l for l in s];j=lambda a,b:[x+y for x,y in zip(a,b)];r=lambda x:[*map(list,zip(*x[::-1]))];return j(s,r(s))+j(r(r(r(s))),r(r(s)))
Try it online!
answered 11 hours ago
HyperNeutrinoHyperNeutrino
20.6k4 gold badges41 silver badges155 bronze badges
20.6k4 gold badges41 silver badges155 bronze badges
1
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
add a comment
|
1
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
1
1
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
$begingroup$
I was not expecting this to happen. Nice work!
$endgroup$
– TwilightSparkle
11 hours ago
add a comment
|
$begingroup$
J, 38 bytes
(,|."1@|.)@(,.|:@|.)@((2$_1*>./)@${.])
Try it online!
No doubt it can be golfed much further.
$endgroup$
add a comment
|
$begingroup$
J, 38 bytes
(,|."1@|.)@(,.|:@|.)@((2$_1*>./)@${.])
Try it online!
No doubt it can be golfed much further.
$endgroup$
add a comment
|
$begingroup$
J, 38 bytes
(,|."1@|.)@(,.|:@|.)@((2$_1*>./)@${.])
Try it online!
No doubt it can be golfed much further.
$endgroup$
J, 38 bytes
(,|."1@|.)@(,.|:@|.)@((2$_1*>./)@${.])
Try it online!
No doubt it can be golfed much further.
edited 11 hours ago
answered 11 hours ago
Galen IvanovGalen Ivanov
9,7071 gold badge14 silver badges40 bronze badges
9,7071 gold badge14 silver badges40 bronze badges
add a comment
|
add a comment
|
$begingroup$
JavaScript (ES6), 178 173 bytes
Takes input as an array of strings. Returns a string.
m=>(g=x=>~y?(Y=y<w?y:W-y,X=x<w?x:W-x,Z=y<w^x<w?Y:X,(m[Z-z*d]||0)[(X^Y^Z)+!z*d]||' ')+[`
`[x-W]]+g(x<W?x+1:!y--):'')(0,w=m[0].length,h=m.length,d=w-h,(z=d>0)?0:w=h,y=W=w*2-1)
Try it online!
$endgroup$
add a comment
|
$begingroup$
JavaScript (ES6), 178 173 bytes
Takes input as an array of strings. Returns a string.
m=>(g=x=>~y?(Y=y<w?y:W-y,X=x<w?x:W-x,Z=y<w^x<w?Y:X,(m[Z-z*d]||0)[(X^Y^Z)+!z*d]||' ')+[`
`[x-W]]+g(x<W?x+1:!y--):'')(0,w=m[0].length,h=m.length,d=w-h,(z=d>0)?0:w=h,y=W=w*2-1)
Try it online!
$endgroup$
add a comment
|
$begingroup$
JavaScript (ES6), 178 173 bytes
Takes input as an array of strings. Returns a string.
m=>(g=x=>~y?(Y=y<w?y:W-y,X=x<w?x:W-x,Z=y<w^x<w?Y:X,(m[Z-z*d]||0)[(X^Y^Z)+!z*d]||' ')+[`
`[x-W]]+g(x<W?x+1:!y--):'')(0,w=m[0].length,h=m.length,d=w-h,(z=d>0)?0:w=h,y=W=w*2-1)
Try it online!
$endgroup$
JavaScript (ES6), 178 173 bytes
Takes input as an array of strings. Returns a string.
m=>(g=x=>~y?(Y=y<w?y:W-y,X=x<w?x:W-x,Z=y<w^x<w?Y:X,(m[Z-z*d]||0)[(X^Y^Z)+!z*d]||' ')+[`
`[x-W]]+g(x<W?x+1:!y--):'')(0,w=m[0].length,h=m.length,d=w-h,(z=d>0)?0:w=h,y=W=w*2-1)
Try it online!
edited 11 hours ago
answered 11 hours ago
ArnauldArnauld
94.3k7 gold badges111 silver badges383 bronze badges
94.3k7 gold badges111 silver badges383 bronze badges
add a comment
|
add a comment
|
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f193951%2fc4-4-reflection%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
1
$begingroup$
I'd suggest to add a test case where the height of the input is strictly greater than its width.
$endgroup$
– Arnauld
11 hours ago