Skip to main content
added 1 character in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 2, 249 248 244 239 237 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%10%7;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='<^>v'[d];m=min(m,X);%c+=d-2|1;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 2, 00] by d=ord(c)%10%7. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by d-2|1. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for help with mapping)

Python 2, 249 248 244 239 237 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%10%7;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='<^>v'[d];m=min(m,X);%c+=d-2|1;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 2, 0 by d=ord(c)%10%7. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by d-2|1. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for help with mapping)

Python 2, 249 248 244 239 237 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%10%7;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='<^>v'[d];m=min(m,X);%c+=d-2|1;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 2, 0] by d=ord(c)%10%7. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by d-2|1. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for help with mapping)

deleted 20 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 2, 249 248 244 239 238237 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%8%5;exec"a%10%7;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='>^<v'[d];m=min;E[X]='<^>v'[d];m=min(m,X);%c+=1|d%%;%c+=d-3;"%2|1;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 02, 2]0 by d=ord(c)%8%5%10%7. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by 1|d%d-32|1. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for help with mapping {1, 2} -> -1, {0, 3} -> 1)

Python 2, 249 248 244 239 238 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%8%5;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='>^<v'[d];m=min(m,X);%c+=1|d%%-3;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 0, 2] by d=ord(c)%8%5. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by 1|d%-3. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for mapping {1, 2} -> -1, {0, 3} -> 1)

Python 2, 249 248 244 239 237 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%10%7;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='<^>v'[d];m=min(m,X);%c+=d-2|1;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 2, 0 by d=ord(c)%10%7. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by d-2|1. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for help with mapping)

added 338 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 2, 249 248 244 239239 238 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%11/3;exec"a%8%5;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='^>v<'[d];m=min;E[X]='>^<v'[d];m=min(m,X);%c-=1|d%%;%c+=1|d%%-3;"%(89-d%288+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 0, 2] by d=ord(c)%8%5. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by 1|d%-3. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for mapping {1, 2} -> -1, {0, 3} -> 1)

Python 2, 249 248 244 239 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%11/3;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='^>v<'[d];m=min(m,X);%c-=1|d%%-3;"%(89-d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

(Thanks to @joriki for mapping {1, 2} -> -1, {0, 3} -> 1)

Python 2, 249 248 244 239 238 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%8%5;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='>^<v'[d];m=min(m,X);%c+=1|d%%-3;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 0, 2] by d=ord(c)%8%5. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by 1|d%-3. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for mapping {1, 2} -> -1, {0, 3} -> 1)

deleted 1 character in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading
added 2 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading
deleted 11 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading
deleted 125 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading
added 10 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading