| Bytes | Lang | Time | Link |
|---|---|---|---|
| 045 | Pip l | 210626T013251Z | DLosc |
| 059 | APL | 210626T050923Z | AviFS |
| 033 | Jelly | 210625T223924Z | caird co |
| 067 | APL Dyalog Extended | 210626T000921Z | user |
| 036 | Japt R | 190423T154550Z | Shaggy |
| nan | PHP | 190423T164030Z | Russ G |
| 034 | 05AB1E legacy | 190423T164231Z | Kevin Cr |
| 033 | Canvas | 190422T203205Z | dzaima |
| 093 | Perl 6 | 190422T191014Z | bb94 |
| 127 | PowerShell | 190422T123647Z | mazzy |
| 126 | C | 140122T000406Z | FireFly |
| 276 | C64 BASIC | 140123T203805Z | friol |
| 186 | Python 2.7 | 140122T033136Z | user8777 |
| 8885 | Ruby | 140121T034306Z | Paul Pre |
| 069 | GolfScript | 140121T033536Z | Volatili |
| 066 | APL | 140121T005048Z | marinus |
Pip -l, 45 bytes
Z:R{sXtRAb:Ab%4\,c"XXXOOoo..."@b}MRaC KXL.CXD
Takes input as a command-line argument. Attempt This Online!
Explanation
High-level:
R{sXtRAb:Ab%4\,c"XXXOOoo..."@b} Apply this function
MR to each match
C KXL.CXD of this regex
a in the input string
Z: Transpose the result
Autoprint as lines (-l flag)
The regex:
XL Lowercase letter [a-z]
K Apply Kleene star [a-z]*
C Wrap in a capturing group ([a-z]*)
XD Digit \d
C Wrap in a capturing group (\d)
. Concatenate ([a-z]*)(\d)
The replacement function takes three arguments: a is the full match, b is the first capturing group (a letter or empty string), c is the second capturing group (a digit).
R{sXtRAb:Ab%4\,c"XXXOOoo..."@b}
s Space character
Xt repeated 10 times
Ab ASCII code of the letter (nil if empty string)
%4 Mod 4 ("a"->1, "b"->2, "c"->3, ""->nil)
\,c Inclusive range from that number to the digit
(treats a left argument of nil as 0)
b: Assign that value to b
RA and replace those indices in the space string
"XXXOOoo..."@b with the equivalent indices in this string
R Reverse to put the "top" of the building at the left
APL, 59 bytes SBCS
{⊖⍉↑(-N)↑¨(L/⍨1,2≤/L←A⍸⍵)↓¨(N←⎕D⍳⍵~A←'abc')↑¨⊂'XXXOOoo...'}
Shorter than the other APL answers so far! I think it can probably be further golfed. Will add explanation soon!
Thanks to dzaima & hyper-neutrino for their advice in the The APL Orchard!
Jelly, 33 bytes
~kµṪV‘RרaiⱮ0xƲ)Ṗz0Ṛị“XXXOOoo...
Full program returning a list of lines. If that isn't acceptable, +2 bytes.
Note the trailing space. Included my favourite:
. .
.. ..
... ...
oooo oooo
ooooo ooooo
OOOOOO OOOOOO
OOOOOOO OOOOOOO
XXXXXXXX XXXXXXXX
XXXXXXXXX XXXXXXXXX
XXXXXXXXXXXXXXXXXXX
How it works
~kµṪV‘RרaiⱮ0xƲ)Ṗz0Ṛị“XXXOOoo... - Main link. Takes a string on the left
~ - Bitwise NOT. This maps digits d to ~d and non-digits to 0
k - Partition the string after falsey values
This groups the string as we want, with a trailing []
µ ) - Over each element, either [L, x] or [x]:
Ṫ - Extract x, modifying the element
V - Evaluate as a digit
‘ - Increment
R - Create a range
Ʋ - Last 4 links as a monad f([L]) or f([]):
ØaiⱮ - Index in the alphabet
0x - Get that many zeros
If the element was [x], this yields []
If the element was [L, x], this returns 1, 2 or 3 zeros, depending on L
× - Multiple elementwise, zeroing the first 1,2 or 3 elements in the range if L is in the element
Ṗ - Remove the trailing [] element
z0 - Transpose, padding with zeros
Ṛ - Reverse
ị“XXXOOoo... - Index into "XXXOOoo... "
APL (Dyalog Extended), 67 bytes
{⊖⍉↑(((' '⍴⍨2⊃⊢),'XXXOOoo...'↑⍨1+⊃)∘⌽0,48|⎕UCS)¨'[abc]?\d'⎕S'\0'⊢⍵}
Longer than the other answer, but I'll try golfing it later. Proper explanation coming soon.
'[abc]?\d'⎕S'\0'⊢⍵- Extract single digits or characters followed by digits(((' '⍴⍨2⊃⊢),'XXXOOoo...'↑⍨1+⊃)∘⌽0,48|⎕UCS)¨- Train to turn each digit or pair into a horizontal string⊖⍉↑- Turn it into a matrix, transpose to make it vertical, and flip it upside-down.
Japt -R, 36 bytes
óȦnãÒXÌ î"XXXOOoo..."hSpXÎnD)s9Ãz3
óȦnãÒXÌ î"..."hSpXÎnD)s9Ãz3 :Implicit input of string
ó :Partition at
È :Characters that return true when passed through the following function
¦ : Test for inequality with
n : Convert to number
à :End function
£ :Map each X
Ò : Bitwise increment
XÌ : Last character of X
î : Slice the following to that length
"..." : Literal string
h : Replace as many characters as necessary at the start of that string with
S : Space
p : Repeat
XÎ : First character of X
n : Convert from base
D : 14
) : End repeat
s9 : Slice off the first 9 characters
à :End map
z3 :Rotate clockwise by 90 degrees 3 times
:Implicit output, joined by newlines
PHP, 131 114 bytes
for($b=10;$b--;print"
")foreach(str_split($argn)as$a)$c=strpos(' abc',$a)?:!print$a<$b|$b<$c?' ':'XXXOOoo...'[$b];
$ echo 2479742|php -nF land.php
.
.
...
ooo
ooo
OOOOO
OOOOO
XXXXXXX
XXXXXXX
XXXXXXX
$ echo 011a2b3b5c9c9b5b3a2110|php -nF land.php
..
..
..
oo
oooo
OOOO
OOOOOO
XXX XXX
XXX XXX
XXX XXX
$ echo a2a0a0a4a0a06a0a0a4a0a0a2a0a0a4a0a06a0a0a4a0a0a2|php -nF land.php
o o
o o
O O O O O O
O O O O O O
X X X X X X X X X
X X X X X X X X X
X X
05AB1E (legacy), 34 bytes
Rvy.ïi"XXXOOoo..."y>£ëðAykÝǝ])ζRí»
Uses the legacy version of 05AB1E to save 2 bytes, since ζ also works on strings instead of just lists of characters.
Explanation:
R # Reverse the (implicit) input-string
v # Loop `y` over each character:
y.ïi # If `y` is a digit:
"XXXOOoo..." # Push string "XXXOOoo..."
y>£ # And only leave the first `y`+1 characters as substring
ë # Else (`y` is a letter):
Ayk # Get the index of `y` in the lowercase alphabet
Ý # Create a list in the range [0, alphabet-index]
ð ǝ # Replace in the string at the top of the stack the characters at
# those indices with a space
] # Close the if-else statement and loop
) # Wrap all strings on the stack into a list
ζ # Zip/transpose; swapping rows/columns
Rí # Reverse this list, as well as each individual line
» # And join the strings by newlines
# (after which the result is output implicitly)
As for my favorite 'building', let's go with this tree. ;)
b2b3b4b5b6b7898b7b6b5b4b3b2
.
...
.....
ooooooo
ooooooooo
OOOOOOOOOOO
OOOOOOOOOOOOO
XXXXXXXXXXXXXXX
XXX
XXX
Perl 6, 93 bytes
{for 9...0 ->\n {say .subst(/(\D)?(.)/,{'XXXOOoo... '.comb[$1>=n>=ord($0//0)-96??n!!10]}):g}}
A block that takes in the string and prints to stdout.
PowerShell, 127 bytes
$r=,''*10
$args|% t*y|%{if($_-in97..99){$b=$_-96}else{,' '*$b+'XXXOOoo...'[$b.."$_"]+,' '*(9-"$_")|%{$r[--$i]+=$_}
$b=$i=0}}
$r
C, 130 126 chars
Kinda long compared to the competition, but I blame the language...
char*p,b[99];r=10,q;main(o){for(gets(&b);r--;puts(""))
for(p=b;q=*p++;)o=q<60?putchar("XXXOOoo... "[o<r&r<q-47?r:10]),-1:q-97;}
I don't know about favourite building, but one of the more recognizable ones around here is Globen, so here is a poor rendition of it.
% ./a.out <<<24556667777776665542
......
oooooooooooo
oooooooooooooooo
OOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOO
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
C64 BASIC, 276 PETSCII chars
My own solution, golfed down to 276 chars and 10 lines of BASIC V2.0!
0inputa$:dIc$(10):fOi=0to9:rE c$(i):nE:fOr=0to9
1z=1
2c=aS(mI(a$,z,z+1))
3ifc>57tHgO8
4ifc>=57-r tH?c$(9-r);:gO6
5?" ";
6z=z+1:ifz<=len(a$)gO2
7?:nE:eN
8z=z+1:w=aS(mI(a$,z,z+1)):ifw>=57-r aNc<=73-r tH?c$(9-r);:gO6
9?" ";:gO6:dA"x","x","x","o","o","W","W",".",".","."
(copy and paste in an emulator to see the result).
And finally, my favourite monument, the Brooklyn Bridge :)

Python 2.7 - 186
Probably can be shorter...
x=[]
l=iter(raw_input())
a="XXX00oo..."
for i in l:
try:i=int(i);o=0
except:o=" abc".index(i);i=int(next(l))
x.append(" "*o+a[o:i+1]+" "*(9-i))
for i in zip(*x)[::-1]:print''.join(i)
Sample run:
08040233245542332040800000247974200000011a2b3b5c9c9b5b3a2110
. ..
. . . ..
. . ... ..
o o ooo oo
o oo o ooo oooo
0 0 0000 0 0 00000 0000
0 0 00 0000 00 0 0 00000 000000
X X XXXXXXXXXXXX X X XXXXXXX XXX XXX
X X XXXXXXXXXXXX X X XXXXXXX XXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX
Sydney Harbour Bridge
a1a13443a1a2a3a4a5a6a6a7a7a8a8a8a8a9a9a9a9a9a9a8a8a8a8a7a7a6a6a5a4a4a3a2a13443a1a1
......
..............
..................
oooooooooooooooooooooo
oooooooooooooooooooooooo
00 000000000000000000000000000 00
0000 00000000000000000000000000000 0000
XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXX
Golden gate bridge / Cisco logo
a2a0a0a4a0a06a0a0a4a0a0a2a0a0a4a0a06a0a0a4a0a0a2
o o
o o
0 0 0 0 0 0
0 0 0 0 0 0
X X X X X X X X X
X X X X X X X X X
X X
Great question by the way!
Ruby, 88 85
Fun challenge!
9.downto(0){|h|puts$*[0].gsub(/(\D?)(.)/){'XXXOOoo... '[h<$1.hex-9||$2.hex<h ?-1:h]}}
Takes input on the commandline, eg:
ruby landscapes.rb 011a2b3b5c9c9b5b3a2110
Will print out:
..
..
..
oo
oooo
OOOO
OOOOOO
XXX XXX
XXX XXX
XXX XXX
GolfScript, 69
'XXXOOoo...':s\{.96>{96-.' '*\@>+}{47-<' '10*+10<s\}if}%10/zip-1%n*\;
Not far off the APL solution.
APL (69 66)
' XXXOOoo...'[1+⌽⍉⌽↑{z×(z<' abc'⍳⍵)<(1+⍎⍺)≥z←⍳10}/↑2↑¨I⊂⍨⎕D∊⍨I←⌽⍞]
Examples:
' XXXOOoo...'[1+⌽⍉⌽↑{z×(z<' abc'⍳⍵)<(1+⍎⍺)≥z←⍳10}/↑2↑¨I⊂⍨⎕D∊⍨I←⌽⍞]
0804023324554233204080
. .
. .
o o
o oo o
O O OOOO O O
O O OO OOOO OO O O
X X XXXXXXXXXXXX X X
X X XXXXXXXXXXXX X X
XXXXXXXXXXXXXXXXXXXXXX
' XXXOOoo...'[1+⌽⍉⌽↑{z×(z<' abc'⍳⍵)<(1+⍎⍺)≥z←⍳10}/↑2↑¨I⊂⍨⎕D∊⍨I←⌽⍞]
011a2b3b5c9c9b5b3a2110
..
..
..
oo
oooo
OOOO
OOOOOO
XXX XXX
XXX XXX
XXX XXX