| Bytes | Lang | Time | Link |
|---|---|---|---|
| 109 | brainfuck | 240806T054141Z | Andrew B |
| 063 | Python 3.8 prerelease | 231123T154321Z | Larry Ba |
| 042 | Ruby | 231122T022117Z | Jordan |
| 064 | PowerShell | 231116T151110Z | Mark Har |
| 063 | Wolfram Language Mathematica | 231118T052123Z | dalamaja |
| 074 | Desmos Graphing Calculator | 231118T011244Z | Infigon |
| 083 | C GCC | 231118T061338Z | Qaziquza |
| 080 | COMMODORE 64 & MSX BASIC Solution as a oneliner | 231116T230920Z | Holger W |
| 028 | Uiua 0.2.0 | 231115T142503Z | RomanPro |
| nan | CP1610 machine code | 231115T024105Z | Arnauld |
| nan | 231114T194123Z | lame-lex | |
| 036 | PowerShell Core | 231116T222530Z | Julian |
| 060 | Haskell | 231114T214604Z | corvus_1 |
| 042 | 6510Assembler for C64 | 231116T203001Z | TGS |
| 046 | /// | 231114T212709Z | Fmbalbue |
| 107 | brainfuck | 231116T152227Z | matteo_c |
| 075 | Google Sheets | 231114T215042Z | doubleun |
| 028 | K ngn/k | 231116T142715Z | bstrat |
| 088 | C# .NET 4.7.2 | 231115T150008Z | lost_in_ |
| 106 | Commodore BASIC V2 or compatible interpreter Most notably the Commodore C64 or C128 noncompeting/just for fun 106 tokenised BASIC bytes | 231116T130153Z | Shaun Be |
| 031 | APL+WIN | 231115T125551Z | Graham |
| 065 | Zsh | 231116T063137Z | roblogic |
| 085 | Acc!! | 231115T200915Z | DLosc |
| 045 | sed | 231115T094330Z | Philippo |
| 014 | 05AB1E | 231115T105557Z | Kevin Cr |
| 134 | Scratch | 231115T125533Z | SectorCo |
| 013 | MathGolf | 231115T113510Z | Kevin Cr |
| 017 | Japt R | 231115T100818Z | Shaggy |
| 059 | JavaScript V8 | 231114T220639Z | Arnauld |
| 014 | Charcoal | 231114T223536Z | Neil |
| 048 | Retina 0.8.2 | 231114T235222Z | Neil |
| 025 | J | 231114T214801Z | Jonah |
| 022 | RProgN 2 | 231115T030733Z | ATaco |
| 042 | Perl 5 | 231114T221925Z | Xcali |
| 047 | ARBLE | 231114T220355Z | ATaco |
| 047 | Python 3 | 231114T210208Z | xnor |
| nan | Vyxal | 231114T205742Z | math sca |
brainfuck, 109 bytes
++++++++[->+>+++++>++++>>+<<<<<]>++>++>>+++>->++[-<<<....<..<.>>>>>]<[-<<...<....<.>>>>]<[-<<..........<.>>>]
ungolfed:
**
**
****
****
****
****
****
****
****
**********
**********
**********
0 0
1 10
2 42
3 32
4 3
5 7
6 2
++++++++
[-
>+
>+++++
>++++
>>+
<<<<<
]
>++
>++
>>+++
>-
>++
[-
<<<....
<..
<.>
>>>>
]
<
[-
<<...
<....
<.>
>>>
]
<
[-
<<..........
<.>
>>
]
Python 3.8 (pre-release), 63 bytes
for i in[[4,2]]*2+[[3,4]]*7+[[0,10]]*3:print(" "*i[0]+"*"*i[1])
PowerShell, 64 bytes (Thanks Julian!)
4,4,(,3*7),0,0,0|%{$_}|%{""|% *ht($_-'0')|% *ht(10-($_-'0'))'*'}
# PowerShell, 85 bytes
foreach($n in 4,4,3,3,3,3,3,3,3,0,0,0){"".PadRight($n-'0').PadRight(10-($n-'0'),'*')}
# PowerShell, 64 bytes
foreach($n in $c){"".PadRight($n-'0').PadRight(10-($n-'0'),'*')}
Thanks to @lost_in_a_musical_note's answer for laying the groundwork!
Wolfram Language (Mathematica), 63 bytes
Uncompress@"1:eJxTTMoPCm5nYGBQAAItrRgDQyMUlpYWtZhacICPBwCDVxow"
It's a bit cheeky, but it gets the job done.
Desmos Graphing Calculator, 75 74 bytes
Display to the screen, eh?
a=[1...9]
b=0a-4
c=[-2...0]
(0a,a) **
(0a,a-3) ****
(b,c) ****
(-b,c) ****
Pasting that in directly will fail because the asterisks are actually part of the label.
C (GCC), 126 83 bytes (thanks to ceilingcat)
main(y){for(;y<14;puts("********"+(y<=9)*6+3/++y*2))printf(" **"+(y>2)+y/10*3);}
COMMODORE 64 & MSX BASIC - Solution as a one-liner, 80 Bytes
0 DATA4,2,2,3,4,7,,10,3:READA,B,C:FORJ=1TOC:PRINTTAB(A):FORI=1TOB:PRINT"*";:NEXT:PRINT:NEXT:GOTO
In C64 must be typed in with abbreviations.
CP-1610 machine code, 47 DECLEs1 = 58.75 bytes
1. CP-1610 instructions are encoded with 10-bit values (0x000 to 0x3FF), known as DECLEs. Although the Intellivision is also able to work on 16-bit, programs were really stored in 10-bit ROM back then.
A full program in 10-bit ROM format, mapped at $4800. This includes an initialization of the video chip so that the display is correct.
ROMW 10 ; use 10-bit ROM
ORG $4800 ; map our program at $4800
4800 0002 EIS ; enable interrupts
4801 0001 SDBD ; R4 = data pointer
4802 02BC 002B 0048 MVII #data, R4
4805 02BD 0200 MVII #$200, R5 ; R5 = BACKTAB pointer
4807 02A0 loop MVI@ R4, R0 ; load data word into R0
4808 0080 TSTR R0 ; if it's zero ...
4809 0204 001A BEQ done ; ... exit
480B 0081 MOVR R0, R1 ; copy R0 to R1
480C 03B9 0007 ANDI #7, R1 ; isolate the 3 least significant bits
480E 0275 line PSHR R5 ; save R5 on the stack
480F 0082 MOVR R0, R2 ; copy R0 to R2
4810 0066 SLR R2, 2 ; right-shift R2 by 3 positions
4811 0062 SLR R2
4812 03BA 0007 ANDI #7, R2 ; isolate the 3 least significant bits
4814 00D5 ADDR R2, R5 ; add that to R5
4815 0083 MOVR R0, R3 ; copy R0 to R3
4816 02BA 0057 MVII #$0057, R2 ; load the value of a white '*' in R2
4818 026A char MVO@ R2, R5 ; write the character
4819 033B 0040 SUBI #$40, R3 ; subtract 64 from R3
481B 0223 0004 BPL char ; keep drawing while it's positive
481D 02B5 PULR R5 ; restore R5
481E 02FD 0014 ADDI #20, R5 ; advance to the next line
4820 0011 DECR R1 ; decrement R1
4821 022C 0014 BNEQ line ; draw another line if it's not zero
4823 0220 001D B loop ; or process the next value
4825 02BD 0030 done MVII #$30, R5 ; R5 = pointer into STIC registers
4827 0268 MVO@ R0, R5 ; no horizontal delay
4828 0268 MVO@ R0, R5 ; no vertical delay
4829 0268 MVO@ R0, R5 ; no border extension
482A 0017 spin DECR R7 ; loop forever
482B 0062 data DECLE $062 ; data format: WWWWPPPNNN
482C 00DF DECLE $0DF ; W = width - 1
482D 0243 DECLE $243 ; P = left padding
482E 0000 DECLE 0 ; N = number of lines
Output
made with jzIntv
Python 3.11 (69 67 bytes nice)
print(''.join(map(lambda a,c:f"{'*'*a:^10}\n"*c,(2,4,10),(2,7,3))))
removed parentheses around fstring thanks to @corvus_192
PowerShell Core, 36 bytes
," **"*2
," ****"*7
,("*"*10)*3
," **"*2 # Creates an array (" **", " **") print it on stdout
," ****"*7 # Same as above
,("*"*10)*3 # Builds and string of 10 stars, then same as above
Haskell, 81 72 60 bytes
unlines[(' '<$['1'..a])++("**"<*[a..'9'])|a<-"998888888555"]
-9 bytes thanks to Unrelated String
-9 byte thanks to ovs
Uses the range syntax [a..'9'] to do substraction.
6510-Assembler for C64, 42 bytes
*=$c000
ldy #23
lda #32
w ldx data,y
q jsr $ffd2
dex
bpl q
eor #10
dey
bpl w
rts
data
!byte 9,29,9,29,9,32,3,35,3,35,3,35,3,35,3,35,3,35,3,36,1,37,1,3
///, 60 54 51 48 47 46 bytes
/a/**//s/ a//w/
aaaaa//b/
sa/ s
sbbbbbbbwww
-1 byte thanks to @Philippos
brainfuck, 107 bytes
>-[-[-<]>>+<]>->>--[<+>++++++]<->++++++++++>++[-<<<....>..>.>]+++++++[-<<<...>....>.>]+++[-<<..........>.>]
Google Sheets, 88 80 79 75 bytes
=let(c,"**",n,"**
",e," "&n,f," "&c&n,g,c&c&c&c&n,e&e&rept(f,7)&g&g&g)
Put the formula in cell A1. It uses simple string concatenation. The whole output is displayed in that one cell.
The text string in n is two asterisks followed by a newline. A literal newline can be specified this way in Google Sheets, saving nine bytes over "&char(10)&".
Structured version (80 bytes):
=map({2;7;3},{4;3;0},{2;4;10},lambda(n,s,a,rept(rept(" ",s)&rept("*",a)&"
",n)))
The output is shown in A1:A3, with newlines in cells. The text string between &" and ",n" is a newline.
C# (.NET 4.7.2), 92 90 87 88 bytes
foreach(var x in "443333333000")Console.WriteLine("".PadRight(x-48).PadRight(58-x,'*'));
Edit: @corvus_192 pointed out that using 48 instead of '0' would save a few chars. Thanks!
Implementation of Arnauld's JS version: https://codegolf.stackexchange.com/a/266751/120291
Commodore BASIC V2 or compatible interpreter (Most notably the Commodore C64 or C128) - non-competing/just for fun - 106 tokenised BASIC bytes
0reada,b,c:s=1:on-(a<.)goto2:forx=1toc:ifsthen?spc(a);:s=.
1fory=1tob:?"**";:next:?:s=1:next:goto
2data4,1,2,3,2,7,0,5,3,-1,,
Here it is in action:
I will add a better explanation later, but for those who maybe are unfamiliar with Commodore BASIC, here is a more readable listing of broadly the same outcome that I made in order to work out the logic before I minimised and crunched the BASIC listing into the three lines in this entry:
APL+WIN, 52 33, 31 bytes
19 bytes saved thanks to Jonah. 2 bytes more by switching from index origin 1 to 0
'* '[2 7 3⌿⊃(⊂10⍴2)⊤¨975 903 0]
Try it online! Thanks to Dyalog Classic
Original code:
m←12 5⍴' '⋄((∊10 35 15⍴¨(⊂5⍴2)⊤¨1 3 31)/,m)←'#'⋄m,⌽m
Zsh, 65 bytes
repeat 2 <<<' **'
repeat 7 <<<' ****'
repeat 3 <<<**********
It's pretty basic, clever tricks like left-padding l:expr::string1: didn't help.
Acc!!, 85 bytes
Count i while i-132 {
Write 32+10*0^((i%11*2-9)^2/(((i/11+5)/7)^2*20+2))-i%11/10*22
}
Explanation
Let's start with this 99-byte version:
Count r while r-12 {
Count c while c-10 {
Write 32+10*0^((c*2-9)^2/(((r+5)/7)^2*20+2))
}
Write 10
}
We have a straightforward nested loop over 12 rows r and 10 columns c, with a newline written at the end of each row. The math to determine space or asterisk runs as follows:
We want to transform the column numbers such that inner columns map to a smaller value than outer columns; then, for each row, we can apply a cutoff so the inner columns become one character and the outer columns become a different character. Acc!! doesn't have an absolute value operator, so we'll use squaring. To preserve symmetry, we double the column number and subtract an odd constant: (c*2-9)^2
c c*2-9 (c*2-9)^2
0 -9 81
1 -7 49
2 -5 25
3 -3 9
4 -1 1
5 1 1
6 3 9
9 9 81
The column cutoff is also dependent on the row number:
- Rows 0-1: cutoff between 1 and 9
- Rows 2-8: cutoff between 9 and 25
- Rows 9-11: cutoff above 81
First, we shift and int-divide the row numbers to quantize them into the correct chunks:
r (r+5)/7
0-1 0
2-8 1
9-11 2
Now a linear function doesn't put the cutoffs in the right range, but a quadratic function does:
(r+5)/7 ((r+5)/7)^2*20+2
0 2
1 22
2 82
Next, we need to check whether the modified column value is greater than or less than the cutoff. We can do this using int division. But that results in different non-zero values, which isn't good for the ASCII-code math we're going to do. We can convert them to 0 and 1 by exploiting the fact that 0^0 = 1 and 0^x = 0 for any positive x in Acc!!.
col cutoff col/cutoff 0^(col/cutoff)
1 2 0 1
9 2 4 0
25 2 12 0
1 22 0 1
9 22 0 1
25 22 1 0
1 82 0 1
9 82 0 1
25 82 0 1
We then multiply that quantity by 10 and add 32, turning 0 into 32 (space) and 1 into 42 (asterisk), and write out the appropriate character.
To get from the 99-byte version to the 85-byte version, we first move the newline-printing into the nested loop. We add an 11th column, which according to the existing math would always be a space (ASCII 32); then we subtract 22 if the column index is >= 10, turning that space into a newline (ASCII 10).
... while c-11 {
Write ... - c/10*22
Now we can combine the two loops into a single loop whose index i runs from 0 to 131. The row number r is simply i/11, and the column number c is i%11.
sed, 45 bytes
Quite straight forward, with some optimisations:
- starting with 3 trailing spaces, which can later be turned into
* - of course using the
pflag for saving one byte s/ /**/4to simply replace one space by two*h;H;Gto produce three identical lines
s/^/ ** /p;p
s/ /**/4p;h;H;G;p;p
s/ /*/g
05AB1E, 16 14 bytes
2Dx7.DTÐ)'*×.c
Explanation:
2 # Push 2
# Stack: 2
D # Duplicate it
# Stack: 2,2
x # Double it (without popping)
# Stack: 2,2,4
7 # Push 7
# Stack: 2,2,4,7
.D # Duplicate the 4 7 times
# Stack: 2,2,4,4,4,4,4,4,4
T # Push 10
# Stack: 2,2,4,4,4,4,4,4,4,10
Ð # Triplicate it
# Stack: 2,2,4,4,4,4,4,4,4,10,10,10
) # Wrap everything on the stack into a list
# Stack: [2,2,4,4,4,4,4,4,4,10,10,10]
'*× '# Convert each to a string of that many "*"
# Stack: ["**","**","****","****",...,"**********"]
.c # Join by newlines and pad leading spaces to centralize the lines
# Stack: " **\n **\n ****\n...\n**********"
# (after which the result is output implicitly)
Scratch, 134 bytes
NOTE: This code assumes that x is already displayed. To see the full *STDOUT* as it is, you should drag the list to the full screen.
Direct solution. Had to add some spaces so it would align up nicely because when Scratch displays lists, line numbers are displayed and modify the position of their corresponding item.
Alternatively, 0 bytes
define
delete[all v]of[x v
add[ **]to[x v
add[ **]to[x v
repeat(7
add[ ****]to[x v
end
repeat(3
add[**********]to[x v
MathGolf, 13 bytes
2_4··♂∙]⌂*♂Ωn
Explanation:
2 # Push 2
_ # Duplicate it
4 # Push 4
·· # Quadruplicate it twice
♂ # Push 10
∙ # Triplicate it
] # Wrap all values on the stack into a list: [2,2,4,4,4,4,4,4,4,10,10,10]
⌂* # Convert each to strings with that many "*"
♂Ω # Centralize the strings to length 10
n # Join the list of padded strings by newlines
# (after which the entire stack is output implicitly as result)
Japt -R, 17 bytes
#p#Þ#Þ555ì Ëç*²Ãû
#p#Þ#Þ555ì Ëç*²Ãû
#p#Þ#Þ555 :Compressed integer 112222222555
ì :To digit array
Ë :Map
ç : Repeat
*² : "*" duplicated
à :End map
û :Centre pad with spaces to the length of the longest
:Implicit output joined with newlines
JavaScript (V8), 59 bytes
-5 thanks to @l4m2
for(n of"443333333000")print("".padEnd(n).padEnd(10-n,"*"))
Charcoal, 14 bytes
↑E333ac×*⍘ιφ‖C
Try it online! Link is to verbose version of code. Explanation:
↑E333ac×*⍘ιφ
Output the first five columns of the figure, whose heights are the hexadecimal digits 333ac, starting at the bottom working up.
‖C
Make a mirror copy to complete the figure.
Retina 0.8.2, 48 bytes
42¶423333333111
3
¶34
1
¶010
(.)(.+)
$1$* $2$**
Try it online! Explanation:
42¶4233333111
Start with the encoding for the first two lines plus an encoded encoding for the remaining lines.
3
¶34
1
¶010
Decode the encoding for the remaining lines. All lines are now singly encoded.
(.)(.+)
$1$* $2$**
Decode the encoding for each line (first digit is number of spaces, other digit(s) is number of asterisks).
J, 25 bytes
'* '{~2 7 3#:@#975,903,0:
This just encodes the full rows as binary numbers, then duplicates them according to the 2 7 3 frequency. This results in a 12 by 10 binary matrix, which is converted to ascii.
I didn't find a way to exploit the symmetry in a way that beats this.
RProgN 2, 22 bytes
00079){3+`**}rT{.]i.};
Explanation
00079){3+`**}rT{.]i.};
00079) # A Stack of the numbers 0, 0, 0, 7, 9 (Each 3 less than the height of half the columns)
{ }r # Replace each number with
3+ # +3
`** # Multiply by "*" (Which repeats "*" x times)
T # Transpose
{ }; # For each row
.] # Concatenate back into a string and duplicate
i. # Inverse the duplicate and concatenate, palindromizing
# Implicit output the contents of the stack.
ARBLE, 47 bytes
explode"112222222555"|rep(" ",5-x)..rep("**",x)
Relatively self explanatory, explodes the string 112222222555 into a list of single characters, each of which represents half the width of the building as it goes down. Then, maps over that list, replacing each entry with a string of 5-x spaces, and 2*x asterisks, which effectively rebuilds it.
Python 3, 47 bytes
for n in b"":print(f"{'**'*n:^10}")
Yawn, bytestrings. I got close with a few other approaches:
48 bytes
for n in[2]*2+[4]*7+[10]*3:print(f"{'*'*n:^10}")
48 bytes
for n in[1]*2+[2]*7+[5]*3:print(-n%5*' '+'**'*n)
This code is 46 bytes in Python 2 where print doesn't need parens. Thanks to dingledooper for -1 byte with -n%5.
49 bytes
print(" **\n"*2+" ****\n"*7+('*'*10+'\n')*3)
50 bytes
n=15
while n-3:print(f"{(5>>n//7)*'**':^10}");n-=1
Vyxal, 97 bitsv2, 12.125 bytes
»ƛ⁼c»yøḊ×v*øm
Bitstring:
0000111111001110001100010001100001000110001001001010100111011011101111010100110110101111000100100
Explanation:
»ƛ⁼c»yøḊ×v*øm
»ƛ⁼c» Decompresses integer => 122753
yøḊ Interleave, Run-length decoding => [1,1,2,2,2,2,2,2,2,5,5,5]
×v* Map repeat asterisk n times
øm Palindromise, center and join by newlines
The more trivial answer »ɽβ≬ǓG»f×v*øm has a higher vyncode score (probably because the compressed part is longer).




