Skip to main content
Saved a few bytes thanks to Fry
Source Link
TFeld
  • 19.9k
  • 3
  • 21
  • 63

Python 2, 311 283.5 271.5258 bytes (622 567 543543 516-50%)

Here's my attempt at an answer.

R=dict(zip(list('abdhlmnostxzABDHIMN'),'eD q pP y l w uU oOGQ sS t xX zZ vV E G H I W N'.split())) V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H='lotxBCDEHIKOX' T='AHIMOTUVWXYilmnotuvwxy' s=raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1]  if notr&=(c in R and l in R[c]):r=0  if not(cv&=c in V or(c in W and l in W[c])):v=0 ifh&=(c in H)+(l in H)<2:h=0>1  if not ct&=c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Python 2, 311 283.5 271.5 bytes (622 567 543-50%)

Here's my attempt at an answer.

R=dict(zip(list('abdhlmnostxzABDHIMN'),'eD q pP y l w uU oOGQ sS t xX zZ vV E G H I W N'.split())) V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H='lotxBCDEHIKOX' T='AHIMOTUVWXYilmnotuvwxy' s=raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1]  if not(c in R and l in R[c]):r=0  if not(c in V or(c in W and l in W[c])):v=0 if(c in H)+(l in H)<2:h=0  if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Python 2, 258 bytes (622 567 543 516-50%)

Here's my attempt at an answer.

R=dict(zip(list('abdhlmnostxzABDHIMN'),'eD q pP y l w uU oOGQ sS t xX zZ vV E G H I W N'.split())) V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H='lotxBCDEHIKOX' T='AHIMOTUVWXYilmnotuvwxy' s=raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] r&=(c in R and l in R[c]) v&=c in V or(c in W and l in W[c]) h&=(c in H)+(l in H)>1 t&=c in T print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Saved some bytes, and fixed Vertical
Source Link
TFeld
  • 19.9k
  • 3
  • 21
  • 63

Python 2, 311 283283.5 271.5 bytes (622 567567 543-50%)

Here's my attempt at an answer.

Not particularly golfed, so quite long (mostly the ambigram values)

R=dict(a='eD',b='q',d='pP',h='y',l='l',m='w',n='uU',o='oOGQ',s='sS',t='t',x='xX',z='zZ',A='vV',B='E',D='G',H='H',I='I',M='W'zip(list('abdhlmnostxzABDHIMN'),N='N''eD q pP y l w uU oOGQ sS t xX zZ vV E G H I W N'.split())) V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H = 'lotxBCDEHIKOX'H='lotxBCDEHIKOX' T = 'AHIMOTUVWXYilmnotuvwxy'T='AHIMOTUVWXYilmnotuvwxy' s = raw_inputs=raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] if not (c in R and l in R[c]):r=0 if not(c in V)+ or(c in W and l in VW[c])<2):v=0 if (c in H)+(l in H)<2:h=0 if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Python 2, 311 283.5 bytes (622 567-50%)

Here's my attempt at an answer.

Not particularly golfed, so quite long (mostly the ambigram values)

R=dict(a='eD',b='q',d='pP',h='y',l='l',m='w',n='uU',o='oOGQ',s='sS',t='t',x='xX',z='zZ',A='vV',B='E',D='G',H='H',I='I',M='W',N='N') V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H = 'lotxBCDEHIKOX' T = 'AHIMOTUVWXYilmnotuvwxy' s = raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] if not (c in R and l in R[c]):r=0 if (c in V)+(l in V)<2:v=0 if (c in H)+(l in H)<2:h=0 if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Python 2, 311 283.5 271.5 bytes (622 567 543-50%)

Here's my attempt at an answer.

R=dict(zip(list('abdhlmnostxzABDHIMN'),'eD q pP y l w uU oOGQ sS t xX zZ vV E G H I W N'.split())) V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H='lotxBCDEHIKOX' T='AHIMOTUVWXYilmnotuvwxy' s=raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] if not(c in R and l in R[c]):r=0 if not(c in V or(c in W and l in W[c])):v=0 if(c in H)+(l in H)<2:h=0 if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Golfed
Source Link
TFeld
  • 19.9k
  • 3
  • 21
  • 63

Python 2, 311311 283.5 bytes (622622 567-50%)

Here's my attempt at an answer.

Not particularly golfed, so quite long (mostly the ambigram values)

R={'a':'eD'R=dict(a='eD','b':'q'b='q','d':'pP'd='pP','h':'y'h='y','l':'l'l='l','m':'w'm='w','n':'uU'n='uU','o':'oOGQ'o='oOGQ','s':'sS's='sS','t':'t't='t','x':'xX'x='xX','z':'zZ'z='zZ','A':'vV'A='vV','B':'E'B='E','D':'G'D='G','H':'H'H='H','I':'I'I='I','M':'W'M='W','N':'N'}N='N') V='ijlmnotuvwxyAHIMOQTUVWXY' W={'b':'d'W=dict(b='d','p':'q'p='q','s':'z's='z','B':'E'B='E','G':'D'G='D','S':'Z'}S='Z') H = 'lotxBCDEHIKOX' T = 'AHIMOTUVWXYilmnotuvwxy' s = raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] if not (c in R and l in R[c]):r=0 if not (c in V and )+(l in V)<2:v=0 if not (c in H and )+(l in H)<2:h=0 if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t or 0 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Python 2, 311 bytes (622-50%)

Here's my attempt at an answer.

Not particularly golfed, so quite long (mostly the ambigram values)

R={'a':'eD','b':'q','d':'pP','h':'y','l':'l','m':'w','n':'uU','o':'oOGQ','s':'sS','t':'t','x':'xX','z':'zZ','A':'vV','B':'E','D':'G','H':'H','I':'I','M':'W','N':'N'} V='ijlmnotuvwxyAHIMOQTUVWXY' W={'b':'d','p':'q','s':'z','B':'E','G':'D','S':'Z'} H = 'lotxBCDEHIKOX' T = 'AHIMOTUVWXYilmnotuvwxy' s = raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] if not (c in R and l in R[c]):r=0 if not (c in V and l in V):v=0 if not (c in H and l in H):h=0 if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t or 0 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Python 2, 311 283.5 bytes (622 567-50%)

Here's my attempt at an answer.

Not particularly golfed, so quite long (mostly the ambigram values)

R=dict(a='eD',b='q',d='pP',h='y',l='l',m='w',n='uU',o='oOGQ',s='sS',t='t',x='xX',z='zZ',A='vV',B='E',D='G',H='H',I='I',M='W',N='N') V='ijlmnotuvwxyAHIMOQTUVWXY' W=dict(b='d',p='q',s='z',B='E',G='D',S='Z') H = 'lotxBCDEHIKOX' T = 'AHIMOTUVWXYilmnotuvwxy' s = raw_input() r=v=h=t=1 for i,j in R.items(): for c in j:R[c]=R.get(c,'')+i for i,j in W.items(): for c in j:W[c]=W.get(c,'')+i for i in range(len(s)): c,l=s[i],s[-i-1] if not (c in R and l in R[c]):r=0 if (c in V)+(l in V)<2:v=0 if (c in H)+(l in H)<2:h=0 if not c in T:t=0 print 'R'*r+'V'*v+'H'*h+'T'*t 

Prints the possible types of ambigrams, or 0 if no ambigrams are possible.

RVHT for rotational, vertical, horizontal and totem respectively.

Source Link
TFeld
  • 19.9k
  • 3
  • 21
  • 63
Loading