Skip to content

@sublee /regular_crossword.py
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Test suite for a regular crossword
# Question: http://www.coinheist.com/rubik/a_regular_crossword/grid.pdf
# My Answer: http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn1/534798_4778312810689_972807554_n.jpg
import re
assert re.match(r'.*H.*H.*', 'NHPEHAS')
assert re.match(r'(DI|NS|TH|OM)*', 'DIOMOMTH')
assert re.match(r'F.*[AO].*[AO].*', 'FOXNXAXPH')
assert re.match(r'(O|RHH|MM)*', 'MMOMMMMRHH')
assert re.match(r'.*', 'MCXNMMCRXEM')
assert re.match(r'C*MC(CCC|MM)*', 'CMCCCCMMMMMM')
assert re.match(r'[^C]*[^R]*III.*', 'HRXRCMIIIHXLS')
assert re.match(r'(...?)\1*', 'OREOREOREORE')
assert re.match(r'([^X]|XCC)*', 'VCXCCHHMXCC')
assert re.match(r'(RR|HHH)*.?', 'RRRRHHHRRU')
assert re.match(r'N.*X.X.X.*E', 'NCXDXEXLE')
assert re.match(r'R*D*M*', 'RRDDMMMM')
assert re.match(r'.(C|HH)*', 'GCCHHCC')
assert re.match(r'.*G.*V.*H.*', 'GRNRVOH')
assert re.match(r'[CR]*', 'CRCRCRRC')
assert re.match(r'.*XEXM*', 'CDXRXEXMM')
assert re.match(r'.*DD.*CCM.*', 'HDDRCORCCM')
assert re.match(r'.*XHCR.*X.*', 'HMXHCRCCXMF')
assert re.match(r'.*(.)(.)(.)(.)\4\3\2\1.*', 'CMEHHEMCNOOD')
assert re.match(r'.*(IN|SE|HI)', 'CMXHHOICMMXIN')
assert re.match(r'[^C]*MMM[^C]*', 'MLRMRIMMMNOH')
assert re.match(r'.*(.)C\1X\1.*', 'ERXEIMCMXMP')
assert re.match(r'[CEIMU]*OH[AEMOR]*', 'UUOHMRMAOE')
assert re.match(r'(RX|[^R])*', 'CRXMXRXMH')
assert re.match(r'[^M]*M[^M]*', 'ELMEHPTA')
assert re.match(r'(S|MM|HHH)*', 'SMMHHHS')
assert re.match(r'.*SE.*UE.*', 'SECUEMC')
assert re.match(r'.*LR.*RL.*', 'MLRCRLMC')
assert re.match(r'.*OXR.*', 'MMXOXRXMH')
assert re.match(r'([^EMC]|EM)*', 'HEMHEMHEMH')
assert re.match(r'(HHX|[^HX])*', 'HHXMIRHHXDC')
assert re.match(r'.*PRR.*DDC.*', 'HPRRMIOHHDDC')
assert re.match(r'.*', 'STXMCMIECRXRG')
assert re.match(r'[AM]*CM(RC)*R?', 'AMAMMCMRCRCR')
assert re.match(r'([^MC]|MM|CC)*', 'HOXMMCCOXRN')
assert re.match(r'(E|CR|MN)*', 'EMNMNCRECR')
assert re.match(r'P+(..)\1.*', 'POXOXCXRV')
assert re.match(r'[CHMNOR]*I[CHMNOR]*', 'HIOMCMRO')
assert re.match(r'(ND|ET|IN)[^X]*', 'NDFMMCH')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.