| Bytes | Lang | Time | Link |
|---|---|---|---|
| 024 | Charcoal | 220119T212816Z | Neil |
| 056 | Haskell | 220120T141457Z | lynn |
| 084 | JavaScript | 220120T070544Z | tsh |
| 020 | J | 220119T223717Z | xash |
| 007 | Jelly | 220119T204031Z | Jonathan |
| 106 | JavaScript ES6 | 220119T201109Z | Rydwolf |
Charcoal, 25 24 bytes
NθWS⊞υιE⪪υθ⭆⪪⌈ιθ⌈⭆ι§⪪νθμ
Try it online! Link is to verbose version of code. Takes the enlargement factor followed by a list of newline-terminated strings. Explanation:
Nθ
Input the enlargement factor.
WS⊞υι
Input the strings.
E⪪υθ⭆⪪⌈ιθ⌈⭆ι§⪪νθμ
Split the list of strings into sublists of length equal to the enlargement factor, split each element of each sublist into strings of the same length, then transpose and take the maximum of the concatenation of each square.
JavaScript, 84 bytes
a=>n=>a.map((r,i)=>r.map((c,j)=>(d=b[i/n|0]||=[])[x=j/n|0]=d[x]?.trim()||c),b=[])&&b
f=
a=>n=>a.map((r,i)=>r.map((c,j)=>(d=b[i/n|0]||=[])[x=j/n|0]=d[x]?.trim()||c),b=[])&&b
str2mat = str => str.split('\n').map(r => [...r]);
mat2str = mat => mat.map(r => r.join('')).join('\n');
test = (s, n) => console.log(mat2str(f(str2mat(s.slice(1, -1)))(n)));
test(String.raw`
\
\
\
`, 3);
test(String.raw`
---------
`, 3);
test(String.raw`
|
|
|
|
|
|
|
|
|
`, 3);
test(String.raw`
| \ / |
| \ / |
| \___/ |
| |
| |
| |
\ /
\ /
\___/
`, 3);
test(String.raw`
_______________
\ /
\ /
\ /
/ \
/ \
/ \
\ /
\ /
\_________/
`, 3);
test(String.raw`
/\
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ ____________ \
| |
| |
| |
| |
| |
| |
/ \
/ \
___/ ______ \___
`, 3);
test(String.raw`
\ /
\ /
\ /
\ /
\/
\ /
\ /
\ /
\ /
\/
`, 5);
test(String.raw`
/ /
/ /
/ /
/ ------- /
/ /
/ /
/ /
\ \
\ \
\ \
\ ------- \
\ \
\ \
\ \
`, 7);
J, 20 bytes
{.@-.&' '@,;.3~2 2&$
With (y x,:h w) u;.3 a we can split a into tiles of size h w while sliding the window by y x. Because we don't want overlapping tiles, we can simply build a 2x2 matrix of the input, e.g. 3 3,:3 3. On these tiles u gets applied, which flattens , the tile into a list, removes any whitespace -.&' ' and then reduces the tile to the first remaining element {..
Jelly, 7 bytes
»/⁹ÐƤ⁺€
A monadic Link accepting a list of lines that yields a list of lines.
How?
»/⁹ÐƤ⁺€ - Link: list of lists of characters, Lines; pixel size, N
ÐƤ - for non-overlapping infixes
⁹ - ...of length: chain's right argument, N
/ - ...yield: reduce by:
- maximum (vectorises)
(Note: space is less than any other character used)
€ - for each:
⁺ - repeat the last link - i.e. do Ṁ⁹ÐƤ
JavaScript (ES6), 106 bytes
x=>n=>x.replace(/.+\n.+\n.+/g,y=>[...(z=y.split`
`)[~-n/2]].map((w,i)=>i%3-1?"":w<"!"?z[n-1][i]:w).join``)
Now actually works!