Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung Nächste Überarbeitung Beide Seiten, nächste Überarbeitung | ||
treffen:codegolfing:004_gc [2022/07/06 09:29] max |
treffen:codegolfing:004_gc [2022/07/07 13:24] max |
||
---|---|---|---|
Zeile 66: | Zeile 66: | ||
</ | </ | ||
+ | Python, nopx, 224B (nachgereicht) | ||
+ | <code Python> | ||
+ | import sys | ||
+ | n=int(sys.argv[1]) | ||
+ | m=n-1 | ||
+ | w=m*m+m+2 | ||
+ | r=range(n) | ||
+ | def p(h,s=0): | ||
+ | l=" " | ||
+ | print(l[: | ||
+ | for e in r: | ||
+ | for l in r: | ||
+ | p(1,m*e+l) | ||
+ | p(w)if e==m else p(m+1, | ||
+ | for _ in r:p(m) | ||
+ | </ | ||
Python, v0tti, 226B | Python, v0tti, 226B | ||
Zeile 122: | Zeile 138: | ||
# Helper function to plot a row | # Helper function to plot a row | ||
- | def plotline(num_hashes, | + | def plotline(num_hashes, |
line = " " | line = " " | ||
Zeile 138: | Zeile 154: | ||
if etagenumber == m: | if etagenumber == m: | ||
# Something special for the last etage: | # Something special for the last etage: | ||
- | plotline( l_left, 0) | + | plotline( l_left ) |
else: | else: | ||
# For all other etages: | # For all other etages: | ||
Zeile 144: | Zeile 160: | ||
# Print trunk | # Print trunk | ||
- | for _ in range(n): plotline( m, 0) | + | for _ in range(n): plotline( m ) |
</ | </ |