109
\$\begingroup\$

Inspired by the bugged output in @Carcigenicate's Clojure answer for the Print this diamond challenge.

Print this exact text:

1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1234567890
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0

(From the middle outward in both directions, each digit is separated by one more space than the previous line.)

Challenge rules:

  • There will be no input (or an empty unused input).
  • Trailing spaces are optional.
  • A single trailing new-line is optional.
  • Leading spaces or new-lines are not allowed.
  • Returning a string-array isn't allowed. You should either output the text, or have a function which returns a single string with correct result.

General rules:

  • This is , so shortest answer in bytes wins.
    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
  • Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
  • Default Loopholes are forbidden.
  • If possible, please add a link with a test for your code.
  • Also, please add an explanation if necessary.
asked Jul 3, 2017 at 7:13
\$\endgroup\$
5
  • \$\begingroup\$ Is outputting an array of strings - 1 string per line - allowed? \$\endgroup\$ Commented Jul 3, 2017 at 9:37
  • \$\begingroup\$ @Shaggy Sorry, in this case it should either return a single string with new-lines, or output the result. I've added this as rule to the challenge. \$\endgroup\$ Commented Jul 3, 2017 at 11:06
  • 1
    \$\begingroup\$ No worries, Kevin; was just chancing my arm to see if I could save myself a couple of bytes. \$\endgroup\$ Commented Jul 3, 2017 at 11:09
  • 3
    \$\begingroup\$ @Shaggy Hehe. What other reason would we have to ask question in a code-golf challenge, besides having the purpose of saving those few bytes? ;) \$\endgroup\$ Commented Jul 3, 2017 at 11:23
  • 14
    \$\begingroup\$ Ha, that's awesome. I was wondering why that answer suddenly got so much attention. Thanks! \$\endgroup\$ Commented Jul 3, 2017 at 19:41

97 Answers 97

4
\$\begingroup\$

PHP, 69 bytes

for(;$i<17;)echo join(str_pad("",abs($i++-8)),range(1,9)+[9=>0]),"
";

Try it online!

answered Jul 3, 2017 at 10:33
\$\endgroup\$
4
\$\begingroup\$

PowerShell, 30 bytes

8..0+1..8|%{1..9+0-join' '*$_}

Try it online!

Constructs a range of 8,7,6...2,1,0,1,2...8 then loops through each number. Inside the loop we construct a range of 1..9 concatenated with 0 then -join the numbers in the range together with the appropriate number of spaces. Each string is left on the pipeline, and output is implicit at program completion.

answered Aug 29, 2017 at 19:42
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Nice answer! Powershell suddenly feels more golfy :) \$\endgroup\$ Commented Aug 29, 2017 at 19:56
4
\$\begingroup\$

Perl 5, (削除) 31 (削除ここまで) 29 bytes

,ドル=$"x abs,say 1..9,0for-8..8

Try it online!

answered Jul 31, 2017 at 20:08
\$\endgroup\$
4
\$\begingroup\$

jq -nr, (削除) 50 (削除ここまで) (削除) 46 (削除ここまで) 45 bytes

[range(9)+1,0|@sh]|join(range(17)-8|" "*fabs) 

Try it on jqplay!

[range(9)+1,0|@sh] generates the array ["1", "2", ..., "9", "0"]. This list is then joined by each of the results from:

range(17)-8: -8, -7, ..., 7, 8
" "*fabs a string of absolute value spaces

answered Sep 4, 2021 at 10:49
\$\endgroup\$
3
  • \$\begingroup\$ Sorry... \$\endgroup\$ Commented Sep 4, 2021 at 11:00
  • \$\begingroup\$ @emanresuA Yeah I've seen that before writing the answer. I will let you know when I posted an answer to a challenge you haven't \$\endgroup\$ Commented Sep 4, 2021 at 11:43
  • \$\begingroup\$ join already uses tostring to take care of the string conversion, so you can drop @sh entirely. \$\endgroup\$ Commented Jul 1 at 21:23
3
\$\begingroup\$

JavaScript, 67 Bytes

f=(i=8)=>i+9?[...`1234567890
`].join(''.padEnd(i<0?-i:i))+f(i-1):''

f=(i=8)=>i+9?[...`1234567890
`].join(''.padEnd(i<0?-i:i))+f(i-1):''
console.log(f())

answered Jul 3, 2017 at 8:44
\$\endgroup\$
3
\$\begingroup\$

LOGO, (削除) 58 (削除ここまで) 57 bytes

for[j 8 -8][repeat 9[type # repeat abs :j[type "\ ]]pr 0]

This should be run on new versions of FMSLogo (link above), where # is repcount in repeat loops. That is a new feature in FMSLogo, which seems to be undocumented.

answered Jul 3, 2017 at 9:59
\$\endgroup\$
3
\$\begingroup\$

QBIC, (削除) 36 (削除ここまで) 32 bytes

[-8,8|?[|?!b%z$';space$(abs(a));

Explanation

[-8,8| FOR a = -8; a <= 8; a++ Sets upthe number of lines
? Kick off each line with a \n
[| FOR b = 1; b <= 10; b++ Loop over each digit: default behaviour for a no-arg FOR declaration
? PRINT 
 ! $ a strng cast (suppresses QBasic's tendency to space out numbers)
 b%z of b modulo 10 (z is 10 in QBIC)
 ' Then take the next bit of code as literal QBasic
 ; Suppress newlines and tabs
 space$ Add x spaces to the output, where X is
 (abs(a)) The absolute line number
 ; And suppress all newlines and tabs after this too
 A closing ` to this code literal is auto added by QBIC at EOF
 Two closing NEXT statements are also auto-added.

Sample output

Just because I really like the pattern. Note that this took some fiddling in QBasic because the usual terminal output is limited to 80 chars and it wraps.

1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1234567890
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
answered Jul 3, 2017 at 15:48
\$\endgroup\$
3
\$\begingroup\$

perl 5: (削除) 43 (削除ここまで), (削除) 39 (削除ここまで), 31 bytes

Needs -E flag (which is free per our consensus).

map{,ドル=$"x abs;say 1..9,0}-8..8

Usage:

perl -E 'map{,ドル=$"x abs;say 1..9,0}-8..8'

Thanks to Dada

answered Jul 3, 2017 at 8:36
\$\endgroup\$
2
  • \$\begingroup\$ That's nice! -E flag is free per our consensus. Also, you probably wanted -8..8 instead of -8..9. And you can save a few bytes by playing with ,ドル instead of $": map{,ドル=$"x abs;say 1..9,0}-8..8 (31 bytes). \$\endgroup\$ Commented Jul 3, 2017 at 9:11
  • \$\begingroup\$ You don't even need to declare @l: just use say 1..9,0 :) \$\endgroup\$ Commented Jul 3, 2017 at 9:17
3
\$\begingroup\$

q/kdb+, 37 bytes

Solution:

-1" "{raze(1_11#.Q.n),\:y#x}'8-(!)17;

Example:

q)-1" "{raze(1_11#.Q.n),\:y#x}'8-(!)17;
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1234567890
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 
1 2 3 4 5 6 7 8 9 0 

Explanation:

q is evaluation right-to-left. Here we are taking the range of -8..0..8, and joining that many spaces with the list "1234567890". We then use -1 to print out to stdout (rather than returning the list of strings).

-1 " "{raze (1_11#.Q.n),\:y#x}'8 - til 17; / ungolfed solution
 til 17 / range of 0..16
 8 - / take 8 from each value, gives -8..0..8
 " "{ }' / each left/right, passes in " " and then -8, -7, etc..
 y#x / take from list " ", note: negatives take from 'back' of list
 ,\: / \: is 'each left', , means concatenate with, so take each left and concatenate with the right
 (1_11#.Q.n) / 'the left'. .Q.n is range 0-9 as a string, take 11 to get 0123..90, then drop the first
 raze / reduce down output list into a single string
-1 ; / print to stdout and swallow return value (-1)

Notes:

Doing (1_11#.Q.n) is 1 byte shorter than the much more straightforward "1234567890"... but as .Q.n returns "0123456789" some manipulation is required.

answered Jul 5, 2017 at 6:29
\$\endgroup\$
3
\$\begingroup\$

Ruby 2.4, 40 bytes

-8.upto 8{|i|puts [*1..9,0]*(' '*i.abs)}

Ruby (lower than 2.4), 41 bytes

-8.upto(8){|i|puts [*1..9,0]*(' '*i.abs)}

Try it online!

answered Jul 5, 2017 at 7:03
\$\endgroup\$
3
\$\begingroup\$

Common Lisp, 85 bytes

(dotimes(i 17)(format t(format()"~~{~~,,~aa~~}
"(abs(- i 8)))'(1 2 3 4 5 6 7 8 9 0)))

Try it online!

format "magic" of Common Lisp:

(dotimes (i 17) ; for i from 0 to 16
 (format t ; print with a format string generated from the next call
 (format () ; with nil as parameter generates a string instead of printing
 "~~{~~,,~aa~~}
" ; generate the format string "~{~,,na~}~%" with n given
 (abs(- i 8))) ; by the value of abs(i-8) (number of spaces)
 '(1 2 3 4 5 6 7 8 9 0))) ; the data to be printed for each line
answered Jul 5, 2017 at 6:21
\$\endgroup\$
3
\$\begingroup\$

MATL, 21 bytes

-9Zv"l4Y29YS10:q@*Q(c

Try it online!

Explanation:

-9Zv % Generates [9 ... 2, 1, 2, ... 9]. 
 " % Iterate over this vector.
 ( % Assignment indexing. Places elements B at positions C in existing vector A.
 l % A: Dummy vector with numeric [1] in it. Is always overwritten by char '1'.
 4Y29YS % B: '0':'9', circularly shifted 9 positions to get '1':'9','0'
 10:q@*Q % C: Equally spaced indexing vector, spacing based on loop variable @.
 c % Convert to char, because A was numeric.

Golfing done:

-9Zv --> built-in, instead of -8:8|Q or even 8:PQ9:h| 
10:q@*Q --> 2 bytes shorter than l@@10*3$:
l ... c --> 1 byte shorter than 'x' (char dummy vector A)

I have attempted to get rid of the 9YS by doing the circular shift in the indexing, but this increased the byte count (10t:qwX\q@*Q instead of 9YS10:q@*Q). However, some interesting patterns were obtained in the process: Try it online!, Try it online!.

answered Jul 6, 2017 at 10:41
\$\endgroup\$
3
\$\begingroup\$

PHP, 76 Bytes

Update: Thanks to Soaku for the addition.

for($i=-9;$i++<8;)echo join(str_repeat(' ',abs($i)),range(1,9)+[9=>0])."
";

Try it online !

PHP, (削除) 88, 86, 80 (削除ここまで)

Thanks to Caird for suggesting the golfing tips.

for($i=-9;$i++<8;)echo join(str_repeat(' ',abs($i)),[1,2,3,4,5,6,7,8,9,0])."\r";

You can try it here!

answered Apr 5, 2018 at 10:07
\$\endgroup\$
3
  • \$\begingroup\$ Welcome to the site, and be sure to check these tips for golfing in PHP! \$\endgroup\$ Commented Apr 5, 2018 at 10:16
  • \$\begingroup\$ Sorry so late, but I golfed it down to 76 bytes \$\endgroup\$ Commented Jun 15, 2018 at 19:37
  • \$\begingroup\$ str_pad("",abs($i)) is four bytes shorter than str_repeat(' ',abs($i)). \$\endgroup\$ Commented Oct 28, 2018 at 9:56
3
\$\begingroup\$

Perl 6, (削除) 43 37 (削除ここまで) 35 bytes

Originally, I came to:

map({say join " "x abs($_-8),1..9,0},0..16)

The say function in perl 6 automatically adds a newline, and it's map works a bit different from perl 5, requiring less parens due to it's more list based approach. Try it online

Fortunately, Jo King showed how to whittle it down further to 35 bytes:

{say join " "x.abs,1..9,0}for ^17-8

Try it online

answered Jul 26, 2018 at 1:03
\$\endgroup\$
6
  • \$\begingroup\$ 0..16 => ^17 \$\endgroup\$ Commented Jul 26, 2018 at 1:08
  • \$\begingroup\$ Or you can change to a list and use the list repetition operator for 37 bytes \$\endgroup\$ Commented Jul 26, 2018 at 1:11
  • \$\begingroup\$ Thanks, there's always more to learn :) Interestingly, the code that runs on TIO perl6 does not run with rakudo, unless I change $++ to $_++ \$\endgroup\$ Commented Jul 26, 2018 at 1:20
  • \$\begingroup\$ Huh. Well, here's 35 byter that uses a for loop \$\endgroup\$ Commented Jul 26, 2018 at 1:24
  • 1
    \$\begingroup\$ Ah, I found the problem with $++ vs $_++, perl6 version 2013.12 built on parrot 5.9.0 revision 0, vs perl6 version 2015.11 built on MoarVM version 2015.11, where it behaves as on TIO. \$\endgroup\$ Commented Jul 26, 2018 at 1:37
3
\$\begingroup\$

R, 51 bytes

for(i in abs(-8:8))cat(1:9,0,"
",sep=strrep(" ",i))

Try it online!

Managed to find some more bytes thanks to JayCe's suggestion in the comments.

answered Jul 26, 2018 at 14:30
\$\endgroup\$
3
\$\begingroup\$

C, (削除) 135 (削除ここまで) 128 characters

-7 characters thanks to kevin cruijssen

#define p printf
i=1,j,h=9,k;main(){for(;++i<22;i<10?h--:h++,p("\n"))for(j=0;++j<11;)for(p(j==10?"0":"%d",j),k=1;k++<h;)p(" ");}

Try it online!


Fun bonus:

On my first compile I got the logic backwards and ended up with the output in reverse

i=1,j,k,h=9;main(){for(;i++<20;){for(j=0;j++<10;){printf(j==10?"0":"%d",j);for(k=1;k++<10-h;){printf(" ");}}i<11?h--:h++;printf("\n");}}

Edit: removed missed whitespace

answered Jul 27, 2018 at 0:15
\$\endgroup\$
4
  • 1
    \$\begingroup\$ Welcome to PPCG! Great first answer. \$\endgroup\$ Commented Jul 27, 2018 at 2:58
  • 2
    \$\begingroup\$ Welcome to PPCG! This is indeed a great first answer, +1 from me. 7 bytes can be saved by removing all the brackets and putting everything inside the loop declarations: i=1,j,h=9,k;main(){for(;++i<22;i<10?h--:h++,p("\n"))for(j=0;++j<11;)for(p(j==10?"0":"%d",j),k=1;k++<h;)p(" ");} 128 bytes Enjoy your stay! \$\endgroup\$ Commented Jul 27, 2018 at 7:01
  • 1
    \$\begingroup\$ 84 bytes by utilizing a single loop, print, and iteration variable, and switching to f() instead of main. \$\endgroup\$ Commented Oct 28, 2018 at 18:53
  • 1
    \$\begingroup\$ 69 bytes building on @Rogem \$\endgroup\$ Commented Dec 23, 2018 at 18:40
3
\$\begingroup\$

J, (削除) 25 (削除ここまで) 22 bytes

(1 j.|i:8)#"{1|.Num_j_

Try it online!

answered Apr 5, 2018 at 9:11
\$\endgroup\$
3
\$\begingroup\$

Vyxal j, 15 bytes

8N8ṡȧƛð$ẋ9ʀ1Ǔ$j

Try it Online!

-1 byte thanks to Aaron Miller

8N -8
 8 8
 ṡ inclusive range; -8, -7, ..., 7, 8
 ȧ abs; 8, 7, ..., 1, 0, 1, ..., 7, 8
 ƛ--------- for each
 ð$ push space and swap it underneath
 ẋ repeat the space N times
 9ʀ [0, 1, ..., 8, 9]
 1Ǔ rotate left once
 $j swap and join
j (flag) join on newlines
answered May 11, 2021 at 6:54
\$\endgroup\$
3
  • \$\begingroup\$ 15 bytes because structures auto-complete \$\endgroup\$ Commented May 11, 2021 at 12:22
  • \$\begingroup\$ @AaronMiller oh right, that's why i was using the j flag \$\endgroup\$ Commented May 11, 2021 at 12:45
  • \$\begingroup\$ 13 bytes \$\endgroup\$ Commented Sep 8, 2021 at 2:20
3
\$\begingroup\$

Dash*, 69 bytes

seq -- -8 8|xargs -I: sh -c 'seq -s"`printf "%:s_"`" 10'|sed s/_1*//g

Hopefully this iteration is fairly self explanatory -- pretty much a straight swap of for to xargs.

Try it online!

Dash*, (削除) 87 (削除ここまで), (削除) 86 (削除ここまで), 73 bytes

for p in `seq -- -8 8`;do seq -s"`printf "%${p}s_"`" 10;done|sed s/_1*//g

Try it online!

Explanation (for method)

for p in `seq -- -8 8`

Produce -8 to 8, used to create separator in next seq. NB BusyBox’s* seq barfs on the -8 without the -- but TIO’s Dash env does not.

;do seq -s"`printf "%${p}s_"`" 10

Print 1-10, separated with p ×ばつ spaces, with an extra _ appended (because seq won't accept an empty separator).

;done|sed s/_1*//g

Remove the _ as well as the 1 from trailing 10.

EDIT: removed a silly space (thanks Kevin Cruijssen)

EDIT: saved many bytes because negative padding printf doesn't matter

EDIT: scraped off another few bytes by ditching the for in favour of xargs.

*Actually this is aimed at Busybox 1.31.1 ash, sed, seq and printf, but TIO didn't have that environment. NB available seq options are limited to -w and -s.

answered Sep 7, 2021 at 8:44
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Welcome to Code Golf, and nice first answer! Be sure to check out our Tips for golfing in Bash page for ways you can golf your program (they're likely to be applicable to Dash as well) \$\endgroup\$ Commented Sep 7, 2021 at 8:46
  • 1
    \$\begingroup\$ Nice first answer, welcome to CGCC! I think you can remove the space between 10 ;? \$\endgroup\$ Commented Sep 7, 2021 at 9:36
  • \$\begingroup\$ Not sure how that sneaked in there, thanks @KevinCruijssen \$\endgroup\$ Commented Sep 7, 2021 at 11:40
3
\$\begingroup\$

Zsh, 48 bytes

for 1 ({9..1} {2..9})printf %-1ドルs {1..9} 0&&echo

Try it Online! (削除) 49b (削除ここまで) (削除) 61b (削除ここまで) (削除) 57b (削除ここまで)

Similar to Spaceship Maw!. -4, -8 bytes thanks to @pxeger.

answered Dec 12, 2020 at 10:49
\$\endgroup\$
2
  • 1
    \$\begingroup\$ 57: Try it online! \$\endgroup\$ Commented Jan 25, 2021 at 19:26
  • 1
    \$\begingroup\$ 49: Try it online! \$\endgroup\$ Commented Mar 27, 2021 at 15:27
3
\$\begingroup\$

Swift 6, (削除) 106 (削除ここまで) 83 bytes

for i in -8...8{print(""+(1...10).flatMap{"\(0ドル%10)"+{String.init}()(" ",abs(i))})}

Try it on SwiftFiddle!

answered Jul 23, 2023 at 20:38
\$\endgroup\$
2
\$\begingroup\$

V, 18 bytes

¬19á08ñÄÓä/& 
YGpH

Try it online!

answered Jul 3, 2017 at 14:29
\$\endgroup\$
2
\$\begingroup\$

Swift 3.1, (削除) 186 (削除ここまで) 182 bytes

func f(_ n:Int=0,_ u:Bool=true){let p={if n<8{f(n+1,u)}};let q={print((1...9).map{String(0ドル)+String(repeating:" ",count:n)}.joined()+"0")};if u{q();p()}else{p();q()}};f(1,false);f()

Explanation

func f(_ n:Int=0,_ u:Bool=true){ function (recursive) that does
 all the heavy-lifting =) 
 n - number of spaces,
 u - go "up" or "down
let p={if n<8 {f(n+1,u)}} closure that runs f on higher step if can
let q={ closure which does the printing
print((1...9).map{ print closed range of number mapped...
String(0ドル)+String(repeating:" ",count:n) ...making String from each number in range
 and appending n spaces to it
.joined()+"0") join all "1 "-like strings and append "0"
if u{q();p()} if go "up" - then call f before printing
else{p();q()} if go "down - the other way
f(1,false);f() run "up" then "down"

Removed some silly spaces. Thanx to Kevin Cruijssen

answered Jul 4, 2017 at 13:49
\$\endgroup\$
3
  • \$\begingroup\$ I feel there is a room for an improvement, though \$\endgroup\$ Commented Jul 4, 2017 at 13:50
  • 1
    \$\begingroup\$ I've never programmed in Swift, so perhaps I'm saying something stupid here, but is it possible to remove some of those spaces? Like the one here: n<8 {f(n+1; here: count:n) }; here: p()} else{p(); and/or here q()}}; f(1,false? \$\endgroup\$ Commented Jul 4, 2017 at 14:24
  • \$\begingroup\$ 171 bytes \$\endgroup\$ Commented Apr 5, 2018 at 16:52
2
\$\begingroup\$

PHP, 71 bytes

while($y<17)echo chunk_split(1234567890,1,str_pad("",abs($y++-8))),"
";

Run with -nr or test it online.

answered Jul 5, 2017 at 7:42
\$\endgroup\$
2
  • \$\begingroup\$ Inspired by your solution, I got my solution down to 66: while($i<17)echo implode(str_pad('',abs($i++-8)),range(1,9))."\n"; \$\endgroup\$ Commented Jul 20, 2017 at 17:48
  • \$\begingroup\$ Oops! Looks like I made an incorrect assumption about the output. I thought it was 123456789 \$\endgroup\$ Commented Jul 20, 2017 at 17:51
2
\$\begingroup\$

Bubblegum, 140 bytes

:P

0000000: ad92 510e c230 0c43 ff39 0547 802c f3bc ..Q..0.C.9.G.,..
0000010: fb5f 8c10 c5d1 5a09 10b0 7d59 b1fd b4b6 ._....Z...}Y....
0000020: b95f eb33 8945 c225 5609 486c 1294 d825 ._.3.E.%V.Hl...%
0000030: 6e17 216d 02fa 84c3 04a3 5033 c906 8e0f n.!m......P3....
0000040: 140c 0c8a 3000 ec50 f743 1987 2abb d83d ....0..P.C..*..=
0000050: eb96 7707 dda0 f215 b70a 7b45 5141 66ac ..w.......{EQAf.
0000060: 5296 19cf 04d2 67ba 4fd3 c2f2 3010 63c6 R.....g.O...0.c.
0000070: 3066 b6f8 8a8d fb0b fb0d eff3 2f7d 77ce 0f........../}w.
0000080: 1faf f3df 773c 7fa5 cedf f707 ....w<......

Try it online!

Do I get brownie points for having ._. two times in the dump?

answered Jul 17, 2017 at 18:25
\$\endgroup\$
4
  • \$\begingroup\$ 131 bytes \$\endgroup\$ Commented Jul 20, 2017 at 18:05
  • 1
    \$\begingroup\$ How did I get out-golfed in Bubblegum? o0 What compression method did you use? \$\endgroup\$ Commented Jul 20, 2017 at 18:07
  • \$\begingroup\$ I used zopfli to generate a DEFLATE stream. I got to 130 bytes with 222 iterations. \$\endgroup\$ Commented Jul 20, 2017 at 18:09
  • \$\begingroup\$ For some reason the byte count went up with more then 314 iterations. zopfli link \$\endgroup\$ Commented Jul 20, 2017 at 18:10
2
\$\begingroup\$

Cubically, 2622 bytes

U3D1R3L1F3B1U1D3+3111111@6-2111@66666666+21111@6-21111@66666666+211111@6-211111@66666666+0@6-0@66666666+01@6-01@66666666+011@6-011@66666666+0111@6-0111@66666666+4@6-4@66666666+41@6-41@66666666+211@6-511111@6+5111111@6-2111@6666666+21111@6-21111@6666666+211111@6-211111@6666666+0@6-0@6666666+01@6-01@6666666+011@6-011@6666666+0111@6-0111@6666666+4@6-4@6666666+41@6-41@6666666+211@6-511111@6+5111111@6-2111@666666+21111@6-21111@666666+211111@6-211111@666666+0@6-0@666666+01@6-01@666666+011@6-011@666666+0111@6-0111@666666+4@6-4@666666+41@6-41@666666+211@6-511111@6+5111111@6-2111@66666+21111@6-21111@66666+211111@6-211111@66666+0@6-0@66666+01@6-01@66666+011@6-011@66666+0111@6-0111@66666+4@6-4@66666+41@6-41@66666+211@6-511111@6+5111111@6-2111@6666+21111@6-21111@6666+211111@6-211111@6666+0@6-0@6666+01@6-01@6666+011@6-011@6666+0111@6-0111@6666+4@6-4@6666+41@6-41@6666+211@6-511111@6+5111111@6-2111@666+21111@6-21111@666+211111@6-211111@666+0@6-0@666+01@6-01@666+011@6-011@666+0111@6-0111@666+4@6-4@666+41@6-41@666+211@6-511111@6+5111111@6-2111@66+21111@6-21111@66+211111@6-211111@66+0@6-0@66+01@6-01@66+011@6-011@66+0111@6-0111@66+4@6-4@66+41@6-41@66+211@6-511111@6+5111111@6-2111@6+21111@6-21111@6+211111@6-211111@6+0@6-0@6+01@6-01@6+011@6-011@6+0111@6-0111@6+4@6-4@6+41@6-41@6+211@6-511111@6+5111111@6+1@6+1@6+1@6+1@6+1@6+1@6+1@6+1@6-111111111@6-511111@6+5111111@6-2111@6+21111@6-21111@6+211111@6-211111@6+0@6-0@6+01@6-01@6+011@6-011@6+0111@6-0111@6+4@6-4@6+41@6-41@6+211@6-511111@6+5111111@6-2111@66+21111@6-21111@66+211111@6-211111@66+0@6-0@66+01@6-01@66+011@6-011@66+0111@6-0111@66+4@6-4@66+41@6-41@66+211@6-511111@6+5111111@6-2111@666+21111@6-21111@666+211111@6-211111@666+0@6-0@666+01@6-01@666+011@6-011@666+0111@6-0111@666+4@6-4@666+41@6-41@666+211@6-511111@6+5111111@6-2111@6666+21111@6-21111@6666+211111@6-211111@6666+0@6-0@6666+01@6-01@6666+011@6-011@6666+0111@6-0111@6666+4@6-4@6666+41@6-41@6666+211@6-511111@6+5111111@6-2111@66666+21111@6-21111@66666+211111@6-211111@66666+0@6-0@66666+01@6-01@66666+011@6-011@66666+0111@6-0111@66666+4@6-4@66666+41@6-41@66666+211@6-511111@6+5111111@6-2111@666666+21111@6-21111@666666+211111@6-211111@666666+0@6-0@666666+01@6-01@666666+011@6-011@666666+0111@6-0111@666666+4@6-4@666666+41@6-41@666666+211@6-511111@6+5111111@6-2111@6666666+21111@6-21111@6666666+211111@6-211111@6666666+0@6-0@6666666+01@6-01@6666666+011@6-011@6666666+0111@6-0111@6666666+4@6-4@6666666+41@6-41@6666666+211@6-511111@6+5111111@6-2111@66666666+21111@6-21111@66666666+211111@6-211111@66666666+0@6-0@66666666+01@6-01@66666666+011@6-011@66666666+0111@6-0111@66666666+4@6-4@66666666+41@6-41@66666666+211@6

Pretty simple, turns the cube to get it into this:

 242
 202
 242
000131555313
010121535343
000131555313
 424
 454
 424

Now the LEFT face sums up to 1. So we use the other faces to get as close to the desired ASCII values as possible, then just increment/decrement by 1.

This also works:

Cubically, 2938 bytes

:4/1+5@6/1+3@66666666+2@6-2@66666666:5+1/1+5@6/1+3@66666666:5+2/1+5@6/1+3@66666666:5+3/1+5@6/1+3@66666666:5+1@6:5/1+3@66666666:1/1+51@6:5/1+3@66666666:2/1+51@6:5/1+3@66666666/1+51@6:5/1+3@66666666/1+5@6:1/1+1@6:4/1+5@6/1+3@6666666+2@6-2@6666666:5+1/1+5@6/1+3@6666666:5+2/1+5@6/1+3@6666666:5+3/1+5@6/1+3@6666666:5+1@6:5/1+3@6666666:1/1+51@6:5/1+3@6666666:2/1+51@6:5/1+3@6666666/1+51@6:5/1+3@6666666/1+5@6:1/1+1@6:4/1+5@6/1+3@666666+2@6-2@666666:5+1/1+5@6/1+3@666666:5+2/1+5@6/1+3@666666:5+3/1+5@6/1+3@666666:5+1@6:5/1+3@666666:1/1+51@6:5/1+3@666666:2/1+51@6:5/1+3@666666/1+51@6:5/1+3@666666/1+5@6:1/1+1@6:4/1+5@6/1+3@66666+2@6-2@66666:5+1/1+5@6/1+3@66666:5+2/1+5@6/1+3@66666:5+3/1+5@6/1+3@66666:5+1@6:5/1+3@66666:1/1+51@6:5/1+3@66666:2/1+51@6:5/1+3@66666/1+51@6:5/1+3@66666/1+5@6:1/1+1@6:4/1+5@6/1+3@6666+2@6-2@6666:5+1/1+5@6/1+3@6666:5+2/1+5@6/1+3@6666:5+3/1+5@6/1+3@6666:5+1@6:5/1+3@6666:1/1+51@6:5/1+3@6666:2/1+51@6:5/1+3@6666/1+51@6:5/1+3@6666/1+5@6:1/1+1@6:4/1+5@6/1+3@666+2@6-2@666:5+1/1+5@6/1+3@666:5+2/1+5@6/1+3@666:5+3/1+5@6/1+3@666:5+1@6:5/1+3@666:1/1+51@6:5/1+3@666:2/1+51@6:5/1+3@666/1+51@6:5/1+3@666/1+5@6:1/1+1@6:4/1+5@6/1+3@66+2@6-2@66:5+1/1+5@6/1+3@66:5+2/1+5@6/1+3@66:5+3/1+5@6/1+3@66:5+1@6:5/1+3@66:1/1+51@6:5/1+3@66:2/1+51@6:5/1+3@66/1+51@6:5/1+3@66/1+5@6:1/1+1@6:4/1+5@6/1+3@6+2@6-2@6:5+1/1+5@6/1+3@6:5+2/1+5@6/1+3@6:5+3/1+5@6/1+3@6:5+1@6:5/1+3@6:1/1+51@6:5/1+3@6:2/1+51@6:5/1+3@6/1+51@6:5/1+3@6/1+5@6:1/1+1@6:4/1+5@6/1+5@6:5+1/1+5@6:5+2/1+5@6:5+3/1+5@6:5+1@6:1/1+51@6:2/1+51@6:3/1+51@6-1@6:1/1+1@6:4/1+5@6/1+3@6+2@6-2@6:5+1/1+5@6/1+3@6:5+2/1+5@6/1+3@6:5+3/1+5@6/1+3@6:5+1@6:5/1+3@6:1/1+51@6:5/1+3@6:2/1+51@6:5/1+3@6/1+51@6:5/1+3@6/1+5@6:1/1+1@6:4/1+5@6/1+3@66+2@6-2@66:5+1/1+5@6/1+3@66:5+2/1+5@6/1+3@66:5+3/1+5@6/1+3@66:5+1@6:5/1+3@66:1/1+51@6:5/1+3@66:2/1+51@6:5/1+3@66/1+51@6:5/1+3@66/1+5@6:1/1+1@6:4/1+5@6/1+3@666+2@6-2@666:5+1/1+5@6/1+3@666:5+2/1+5@6/1+3@666:5+3/1+5@6/1+3@666:5+1@6:5/1+3@666:1/1+51@6:5/1+3@666:2/1+51@6:5/1+3@666/1+51@6:5/1+3@666/1+5@6:1/1+1@6:4/1+5@6/1+3@6666+2@6-2@6666:5+1/1+5@6/1+3@6666:5+2/1+5@6/1+3@6666:5+3/1+5@6/1+3@6666:5+1@6:5/1+3@6666:1/1+51@6:5/1+3@6666:2/1+51@6:5/1+3@6666/1+51@6:5/1+3@6666/1+5@6:1/1+1@6:4/1+5@6/1+3@66666+2@6-2@66666:5+1/1+5@6/1+3@66666:5+2/1+5@6/1+3@66666:5+3/1+5@6/1+3@66666:5+1@6:5/1+3@66666:1/1+51@6:5/1+3@66666:2/1+51@6:5/1+3@66666/1+51@6:5/1+3@66666/1+5@6:1/1+1@6:4/1+5@6/1+3@666666+2@6-2@666666:5+1/1+5@6/1+3@666666:5+2/1+5@6/1+3@666666:5+3/1+5@6/1+3@666666:5+1@6:5/1+3@666666:1/1+51@6:5/1+3@666666:2/1+51@6:5/1+3@666666/1+51@6:5/1+3@666666/1+5@6:1/1+1@6:4/1+5@6/1+3@6666666+2@6-2@6666666:5+1/1+5@6/1+3@6666666:5+2/1+5@6/1+3@6666666:5+3/1+5@6/1+3@6666666:5+1@6:5/1+3@6666666:1/1+51@6:5/1+3@6666666:2/1+51@6:5/1+3@6666666/1+51@6:5/1+3@6666666/1+5@6:1/1+1@6:4/1+5@6/1+3@66666666+2@6-2@66666666:5+1/1+5@6/1+3@66666666:5+2/1+5@6/1+3@66666666:5+3/1+5@6/1+3@66666666:5+1@6:5/1+3@66666666:1/1+51@6:5/1+3@66666666:2/1+51@6:5/1+3@66666666/1+51@6:5/1+3@66666666/1+5@6

Uses the existing cube and division to get the required ASCII values.

Found using these answers.

answered Jul 31, 2017 at 19:19
\$\endgroup\$
2
\$\begingroup\$

QBasic, 66 bytes

An undeclared subroutine that takes no input and outputs to STDOUT

FOR i=-8TO 8
FOR j=49TO 57
?CHR$(j)SPC(ABS(i));
NEXT
?"0
NEXT
answered Jul 26, 2018 at 15:15
\$\endgroup\$
2
\$\begingroup\$

Deadfish~, 2959 bytes

{iiiii}dc{dd}iiicccccccc{ii}ddc{dd}iicccccccc{ii}dc{dd}icccccccc{ii}c{dd}cccccccc{ii}ic{dd}dcccccccc{ii}iic{dd}ddcccccccc{ii}iiic{dd}dddcccccccc{ii}iiiic{dd}ddddcccccccc{ii}iiiiic{dd}dddddcccccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiiccccccc{ii}ddc{dd}iiccccccc{ii}dc{dd}iccccccc{ii}c{dd}ccccccc{ii}ic{dd}dccccccc{ii}iic{dd}ddccccccc{ii}iiic{dd}dddccccccc{ii}iiiic{dd}ddddccccccc{ii}iiiiic{dd}dddddccccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicccccc{ii}ddc{dd}iicccccc{ii}dc{dd}icccccc{ii}c{dd}cccccc{ii}ic{dd}dcccccc{ii}iic{dd}ddcccccc{ii}iiic{dd}dddcccccc{ii}iiiic{dd}ddddcccccc{ii}iiiiic{dd}dddddcccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiiccccc{ii}ddc{dd}iiccccc{ii}dc{dd}iccccc{ii}c{dd}ccccc{ii}ic{dd}dccccc{ii}iic{dd}ddccccc{ii}iiic{dd}dddccccc{ii}iiiic{dd}ddddccccc{ii}iiiiic{dd}dddddccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicccc{ii}ddc{dd}iicccc{ii}dc{dd}icccc{ii}c{dd}cccc{ii}ic{dd}dcccc{ii}iic{dd}ddcccc{ii}iiic{dd}dddcccc{ii}iiiic{dd}ddddcccc{ii}iiiiic{dd}dddddcccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiiccc{ii}ddc{dd}iiccc{ii}dc{dd}iccc{ii}c{dd}ccc{ii}ic{dd}dccc{ii}iic{dd}ddccc{ii}iiic{dd}dddccc{ii}iiiic{dd}ddddccc{ii}iiiiic{dd}dddddccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicc{ii}ddc{dd}iicc{ii}dc{dd}icc{ii}c{dd}cc{ii}ic{dd}dcc{ii}iic{dd}ddcc{ii}iiic{dd}dddcc{ii}iiiic{dd}ddddcc{ii}iiiiic{dd}dddddcc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiic{ii}ddc{dd}iic{ii}dc{dd}ic{ii}c{dd}c{ii}ic{dd}dc{ii}iic{dd}ddc{ii}iiic{dd}dddc{ii}iiiic{dd}ddddc{ii}iiiiic{dd}dddddc{i}iiiiiic{dddd}iic{iiii}dcicicicicicicicic{d}ic{dddd}iic{iiii}dc{dd}iiic{ii}ddc{dd}iic{ii}dc{dd}ic{ii}c{dd}c{ii}ic{dd}dc{ii}iic{dd}ddc{ii}iiic{dd}dddc{ii}iiiic{dd}ddddc{ii}iiiiic{dd}dddddc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicc{ii}ddc{dd}iicc{ii}dc{dd}icc{ii}c{dd}cc{ii}ic{dd}dcc{ii}iic{dd}ddcc{ii}iiic{dd}dddcc{ii}iiiic{dd}ddddcc{ii}iiiiic{dd}dddddcc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiiccc{ii}ddc{dd}iiccc{ii}dc{dd}iccc{ii}c{dd}ccc{ii}ic{dd}dccc{ii}iic{dd}ddccc{ii}iiic{dd}dddccc{ii}iiiic{dd}ddddccc{ii}iiiiic{dd}dddddccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicccc{ii}ddc{dd}iicccc{ii}dc{dd}icccc{ii}c{dd}cccc{ii}ic{dd}dcccc{ii}iic{dd}ddcccc{ii}iiic{dd}dddcccc{ii}iiiic{dd}ddddcccc{ii}iiiiic{dd}dddddcccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiiccccc{ii}ddc{dd}iiccccc{ii}dc{dd}iccccc{ii}c{dd}ccccc{ii}ic{dd}dccccc{ii}iic{dd}ddccccc{ii}iiic{dd}dddccccc{ii}iiiic{dd}ddddccccc{ii}iiiiic{dd}dddddccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicccccc{ii}ddc{dd}iicccccc{ii}dc{dd}icccccc{ii}c{dd}cccccc{ii}ic{dd}dcccccc{ii}iic{dd}ddcccccc{ii}iiic{dd}dddcccccc{ii}iiiic{dd}ddddcccccc{ii}iiiiic{dd}dddddcccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiiccccccc{ii}ddc{dd}iiccccccc{ii}dc{dd}iccccccc{ii}c{dd}ccccccc{ii}ic{dd}dccccccc{ii}iic{dd}ddccccccc{ii}iiic{dd}dddccccccc{ii}iiiic{dd}ddddccccccc{ii}iiiiic{dd}dddddccccccc{i}iiiiiic{dddd}iic{iiii}dc{dd}iiicccccccc{ii}ddc{dd}iicccccccc{ii}dc{dd}icccccccc{ii}c{dd}cccccccc{ii}ic{dd}dcccccccc{ii}iic{dd}ddcccccccc{ii}iiic{dd}dddcccccccc{ii}iiiic{dd}ddddcccccccc{ii}iiiiic{dd}dddddcccccccc{i}iiiiiic{dddd}iic
answered Mar 28, 2021 at 6:09
\$\endgroup\$
2
\$\begingroup\$

Excel, 74 bytes

=LET(x,MOD(COLUMN(A:J),10),CONCAT(x&IF(x,REPT(" ",ABS(ROW(1:17)-9)),"
")))

Link to Spreadsheet

The version without LET that would have been valid when the question was asked is only 2 bytes longer.

Without LET, 76 bytes

=CONCAT(RIGHT(COLUMN(A:J))&IF(COLUMN(A:J)>9,"
",REPT(" ",ABS(ROW(1:17)-9))))
answered Sep 4, 2021 at 14:29
\$\endgroup\$
2
\$\begingroup\$

Java (JDK), (削除) 105 (削除ここまで) 103 bytes

a->{for(int j,i=-9;i++<8;){var s="";for(j=0;j++<9;)s+=j+" ".repeat(i<0?-i:i);System.out.println(s+0);}}

Try it online!

Thanks to ceilingcat for -2

answered Sep 4, 2021 at 14:06
\$\endgroup\$
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.