Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Python 2, (削除) 370 (削除ここまで) (削除) 369 (削除ここまで) 368 bytes

Thanks to @sanchises @sanchises and @edc65 @edc65 for saving me a byte each.

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d<1:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Python 2, (削除) 370 (削除ここまで) (削除) 369 (削除ここまで) 368 bytes

Thanks to @sanchises and @edc65 for saving me a byte each.

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d<1:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Python 2, (削除) 370 (削除ここまで) (削除) 369 (削除ここまで) 368 bytes

Thanks to @sanchises and @edc65 for saving me a byte each.

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d<1:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

added 208 characters in body
Source Link
Zach Gates
  • 6.7k
  • 31
  • 75

Python 2, (削除) 370 (削除ここまで) 369(削除) 369 (削除ここまで) 368 bytes

Thanks to @sanchises and @edc65 for saving me a byte each.

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d==0d<1:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Python 2, (削除) 370 (削除ここまで) 369 bytes

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d==0:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Python 2, (削除) 370 (削除ここまで) (削除) 369 (削除ここまで) 368 bytes

Thanks to @sanchises and @edc65 for saving me a byte each.

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d<1:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

added 10 characters in body
Source Link
Zach Gates
  • 6.7k
  • 31
  • 75

Python 2, 370(削除) 370 (削除ここまで) 369 bytes

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d==0:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d==3d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Python 2, 370 bytes

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d==0:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d==3:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Python 2, (削除) 370 (削除ここまで) 369 bytes

J=''.join
u=raw_input().replace('\t',' \t ')
w=u[:]
G=range(len(u))
d,r=0,[[' 'for _ in G]for _ in G]
u=u.split('\n')
for t in G:
 x,y=0,0+t
 for c in u[t]:
 if c=='\t':d=(d+1)%4
 if c!='\t':
 if c.strip():r[y][x]=c
 if d==0:x+=1
 if d==1:y+=1
 if d==2:x-=1
 if d>2:y-=1
r=r[:max(i for i,n in enumerate(r)if J(n).strip())+1]
for i in r:print J(i).rstrip()

It generates the largest grid possible and then loops around, character by character, switching direction at each tab.

Source Link
Zach Gates
  • 6.7k
  • 31
  • 75
Loading

AltStyle によって変換されたページ (->オリジナル) /