treffen:codegolfing:004_gc

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
Letzte Ü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:
 </code> </code>
  
 +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=" "*(w-h-s)+"#"*h+" "*s
 +    print(l[:-1]+l[::-1])
 +for e in r:
 +    for l in r:
 +        p(1,m*e+l)
 +    p(w)if e==m else p(m+1,m*e+1)
 +for _ in r:p(m)
 +</code>
  
 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,num_spaces):+def plotline(num_hashes,num_spaces :int =0):
  
     line = " "*(l_left - num_hashes - num_spaces) + "#"*num_hashes + " "*num_spaces     line = " "*(l_left - num_hashes - num_spaces) + "#"*num_hashes + " "*num_spaces
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 ) 
 </code> </code>
  • treffen/codegolfing/004_gc.txt
  • Zuletzt geändert: 2022/07/07 13:26
  • von max