Skip to main content
4 of 6
added 3 characters in body
Claudiu
  • 4k
  • 1
  • 21
  • 26

Python, 250 245 242 characters

A very different approach which ended up beating out my other one! Input processing code is similar but that's about it.

N='J'+raw_input()+' '
X=N[1]>'G'
a,b,c=N[X:3+X]
z=ord(a)*7/2-246-(ord(b)+3)%7
for r in range(21):
 L=' -'[r%2];F=' -'[2<r<12and r%2]
 if min(3,z)<=r<=max(11,z):print F+((L,'|')[8>z<r<z+4],(L,c)[' '<c])[r==z]+(L,'o')[r==z]+(L,'|')[z-4<r<z>7]+F

I mapped out each character's value based on the row and column and then golfed the printing:

#given row r, with note on row n, how to print each char?
#rows are:
#       HB : 0
#  ---  HA : 1
#       HG : 2
# ----- HF : 3
#       HE : 4
# ----- HD : 5
#       HC : 6
# ----- B  : 7
#       A  : 8
# ----- G  : 9
#       F  : 10
# ----- E  : 11
#       D  : 12
#  ---  C  : 13
#       LB : 14
#  ---  LA : 15
#       LG : 16
#  ---  LF : 17
#       LE : 18
#  ---  LD : 19
#       LC : 20
#chars are:
# 0 | 1 | 2 | 3 | 4
#
# 0,4:
#    if r%2:
#      if 2<r<12: '-'
#      else ' '
#    else: ' '
# 1: ' -b#|'
#    if r==n:
#      if A: c
#      else: ' -'[r%2]
#    elif n<8 and n<r<n+4: '|'
#    else: ' -'[r%2]
# 2: ' -o'
#    if r==n: 'o'
#    else: ' -'[r%2]
# 3: ' -|'
#    if n>7 and n-4<r<n: '|'
#    else: ' -'[r%2]
Claudiu
  • 4k
  • 1
  • 21
  • 26