행맨 솔버 작성


28

행맨 솔버를 작성해야합니다. 영어 단어 목록 에 대한 테스트 [1] , 가장 많은 수의 단어를 푸는 솔버가 승리합니다. 단어 목록의 모든 단어는 무작위 순서로 테스트됩니다.

[1] :이 단어 목록은 여기 에서 가져온 다음 숫자가 제거 된 다음 길이가 1이거나 알파벳이 아닌 문자가 제거 된 단어 중 가장 빈번한 4096 개의 고유 단어가이 단어 목록으로 선택됩니다.

세부 사항 :

귀하의 프로그램은 게임 프로그램과 상호 작용하여 밑줄과 올바르게 추측 된 문자를 제공합니다. 당신의 프로그램은 당신의 추측을 돋보이게 할 것이며, 이전의 추측이 옳았는지 아닌지의 입력으로부터 추론해야합니다. 6 번 틀린 후에는 프로그램이 사라집니다. 각 게임이 끝난 후 (승패 후) 다음 게임을위한 프로그램이 준비되어 있어야합니다.

코드 길이는 2048 바이트 미만이어야하며 프로그램은 외부 리소스를 사용해서는 안됩니다 (로컬 저장소 또는 인터넷에서 단어 목록에 액세스하는 것을 포함하되 이에 국한되지 않음).

: (입력은 >설명을 위해서만 여기에 옵니다 -실제로는 입력에 존재하지 않습니다)

>_______         // 7 underscores
a                // Now you wait for input again
>_a___a_
e
>_a___a_         // Implies that your guess is wrong
>_____           // new round, this will be given ONLY IF you already have 6 losses

당신이 6 번 틀렸다고 가정하면, 당신의 추측이 틀렸다는 것을 암시하는 최종 입력을받을 것이며, 프로그램은 새로운 라운드를 시작할 준비가되어 있어야합니다 (즉, 다른 입력을받습니다).

이기면

>_angman
h
>hangman
>_____           // new round

입력에 밑줄이 없기 때문에 이겼 음을 알면 다음 라운드를 수락 할 준비가되어 있어야합니다.

입력을 받으면 프로그램을 종료해야합니다 END.

프로그램이 결정적이지 않은 경우 (임의성, 의사 난수, 시스템 시간, 주변 온도, 기분 등에 따라 다름), 제출시 명시 적으로 진술해야하며 점수는 10 배 (나에게 지시되지 않은 한) 평균.

참고 : 파이썬과 같은 언어를 사용하는 경우 각 인쇄 문 후에 stdout을 명시 적으로 플러시하십시오.

게임 프로그램은 다음과 같습니다 (신용에서 nneonneo로 ).

import sys, random, subprocess

proc = subprocess.Popen(sys.argv[1:], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
def p(x):
    proc.stdin.write(x+'\n')
    proc.stdin.flush()

wordlist=[]
f=open('wordlist.txt', 'r')
for i in f:
    wordlist.append(i[:-1] if i[-1]=='\n' else i)
# wordlist=[i[:-1] for i in f]
random.shuffle(wordlist)

score=0
totalerr=0

for s in wordlist:
    s2=[]
    for i in s:
        s2.append('_')
    err=0
    p(''.join(s2))
    while err<6 and '_' in s2:
        c=proc.stdout.readline().strip()
        nomatch=True
        for i in range(0, len(s)):
            if s[i]==c:
                s2[i]=c
                nomatch=False
        if nomatch:
            err+=1
            totalerr+=1
        p(''.join(s2))
    if err<6:
        score+=1
p('END')
sys.stderr.write('score is '+str(score)+', totalerr is '+str(totalerr)+'\n')

용법: python ./game.py [yoursolverprogram]

예: python ./game.py ruby ./solver.rb

이것은 이전 스코어링 프로그램처럼 작동하지만 명명 된 파이프에 의존하지 않으므로 다른 플랫폼에서 작동 할 수 있습니다. 이전 버전에 관심이있는 경우 개정 내역을 참조하십시오.


어떤 런타임 환경이 있습니까? node.js를 사용할 수 있습니까?
aebabis

제출물이 글자를 추측하지 않은 단어에 실패하고 다음 단어의 길이가 같은 경우 6 개의 추측이 경과 한 입력 만 결정할 수 없습니다. 따라서 제출은 상태로 추측의 수를 저장해야합니다.
laindir

1
"귀하의 프로그램이 결정적이지 않은 경우 (임의, 의사 난수, 시스템 시간, 주변 온도, 내 기분 등에 따라 다름) 제출 내용에 명시 적으로 명시해야하며 별도의 지시가없는 한 점수는 10 배가됩니다. ) 및 평균입니다. " 귀하의 테스트 프로그램은 결정 론적이지 않으므로 모든 제출물에서 이와 같이 진행하는 것이 공정하다고 생각하십니까?
Martin Ender

1
@ace 제출 한 단어가 이미 사용 된 단어를 기억한다면 아닙니다. ;) 테스트 프로그램의 의사 난수이지만 "프로그램은 의사 난수에 의존합니다"카테고리에 속한다고 생각합니다. : D
Martin Ender

2
@ace : subprocess게임을 구동하기 위해 외부 fifo 대신 사용 을 제안 할 수 있습니까? 이렇게하면 다른 OS (예 : Windows의 Cygwin)에서 코드가 작동합니다. 다음 은 명령 행에서 이름 지정된 프로그램을 시작하는 game.py데 사용 subprocess하도록 수정되었습니다 : gist.github.com/nneonneo/d173f8888e1ea0c6fe37 . python game.py <program> [args]예를 들어 로 사용하십시오 python game.py python hangman.py.
nneonneo

답변:


1

파이썬 2, 점수 = 2111

로 실행하십시오 python -u. (주어진 컨트롤러로 테스트 할 경우 python ./game.py python -u ./solver.py) 2044 바이트 + 1 -u= 2045 바이트입니다.

I=raw_input
a=I()
while'^'<a:
 c=g=''
 while len(set(g)-set(a))<6and'_'in a:
	m=1879
	while c in g:c='eunotitihencatpangnaottoesthesdoeitmbolocepnngcbelympvhanlrarnnccinatceaesdabceatelittlvuumineiltlatrnrttnomnnlnaildplttryliaxgtssclhemngfrssioninssenryinoeovortpcntapeetedlrruitardooiitacteutrsotdsoanedytsacnstshesmoeloluaiaceaceuhlortnegveprreanslrraneioeitslincssdsisuosycmieiebrinncrueoinytnabatepcciamenitnisecgaannehiphanotntnorvrvpcaddcdiittdnnieirsytescdeaaorfrerroleomdaeripmaandrgndipaimesctrsliavnopstmhiagamnimnlaaieceotlarscnbvnssvtaslplpisoiicinynriilirelaiohllvlndohenossvildgerltgterisahcreridsctnedainmteooeelnppeiemitceciyndetgfltrtsnatlrasrnsreiueletunsttainrctreydcpmiieecpedarulcaosoiulinrtpinoopptcpuarnioredabtilsnleoonslmltircninloaludrltrviocsatcgratduioeietnseaidltmmryalaaaorbctaglnlatatiosnloettuongaetlndesicircelunoeaofaciunhcdnnteeadtaadteairceneangugipadcrhaetftoloilisesaeaishtcinemcoleiibloyuoeiupovgtrccttsuttialnnnncatbamtrrndtperieonsavseoalncrrvvmctdmornstsunilnrscariranagloeoeciteptiplctpmadtnertslioractotlairneutorccaocletedoaammiiaurcadgdsmtmooaefmhedetvoelmoaemoaacoeieneislsaccllsunacnnspaomtdpnioocposrocniciicounnatosuvrsrodreacloapcansrsnrohlnotpiiptdneauaaatorofaatsnigiioegloreraiipaitnsssrststetomtoneifencntopxmstsruiosgopanriapiapelteeeelraaeeeipavauptneaalinnrlgipgoteienenrnfdmorouslpcaprmaeusnnnclltpcasrsitiuaictigsarsdenteetrtelnrecurupmautosotrssnisrdsnnulisrgomnpeatyotioipetalyanluatsoteoytirsmssyeatpryrtfclfnttniscloeuiaerasniracntfglaylurotngoaesuetillrrldnranosteldmpooonticteaprdcdmoecaafnftaivsmtrtlrpigcrnodueusmyepeotpnotltalgtltlvyhspphrtaliemyrtehrrdeiesoiiteptsptintnypmoinspsgiocacurarpruiardmnmrpgtpnoimtlsonpacrsnenpcinantayvryumpncyaelnrtrsisrdmnspgmarlttttptitsmeipuaervntgcunnncrtrnnitbltarssmaircptrenrerrerpceoiedchecefbrttutbumnbsnoeitaenutetreccosttofcdtgslgeaoacmicuiotelornahmticcsrdswaoignancoelrrsarnrnrrptiyadetilcricnasnoasenpstasiopdtnossrccllsoelirtfarrioemaeosioaeorcaesfnfsthklcsrdhlwakl'[int(a.replace('_','1'),36)%m];m-=6
	print c;g+=c;a=I()
 a=I()

결과

score is 2111, totalerr is 20751

작동 원리

이 프로그램은 현재 상태에서 모든 _s를 1s로 바꾸고 결과를 base-36 정수로 취급하고 모듈러스 1879를 취하여 조잡한 해시 함수를 제공합니다. 이 해시 값을 긴 문자열로 인덱싱하여 추측 할 문자를 선택합니다. 이전에 해당 문자를 이미 추측 한 경우 계수가 6만큼 감소하고 (항상 상대적으로 소수는 36으로 유지됨) 다른 문자를 선택하여 아직 추측하지 못한 문자를 찾을 때까지 반복합니다.

나는이 전략을 조정 가능한 많은 변수 (긴 문자열의 개별 문자)를 갖도록 설계했으며, 대부분은 독립적으로 최종 점수에 약간의 영향을 미칩니다. 따라서 언덕 등반 스타일 최적화에 매우 적합합니다. 저는 다양한 늦은 수락 검색을 사용했습니다. .

파이썬 2, 점수 = 2854

인쇄 할 수없는 바이트와 내장 압축을 자유롭게 사용하면 더 많은 정보를 얻을 수 있습니다.

로 디코딩 xxd -r하고로 실행하십시오 python -u. (주어진 컨트롤러로 테스트하는 경우 python ./game.py python -u ./solver.py.) -u= 2048 바이트의 경우 2047 코드 바이트 + 1입니다 .

00000000: efbb bf49 3d72 6177 5f69 6e70 7574 0a61  ...I=raw_input.a
00000010: 3d49 2829 0a77 6869 6c65 275e 273c 613a  =I().while'^'<a:
00000020: 0a20 633d 673d 2727 0a20 7768 696c 6520  . c=g=''. while 
00000030: 6c65 6e28 7365 7428 6729 2d73 6574 2861  len(set(g)-set(a
00000040: 2929 3c36 616e 6427 5f27 696e 2061 3a0a  ))<6and'_'in a:.
00000050: 096d 3d33 3433 310a 0977 6869 6c65 2063  .m=3431..while c
00000060: 2069 6e20 673a 633d 2727 2778 da05 c101   in g:c='''x....
00000070: 62a8 3808 04d0 b322 1923 bf04 b230 b1f5  b.8....".#...0..
00000080: f6fb 1e42 6c73 475a e2e1 277d 3d19 d0c1  ...BlsGZ..'}=...
00000090: 5f9e d177 4f21 50d6 67ab 49b2 9ce1 09cb  _..wO!P.g.I.....
000000a0: b4ca 793e ab4a 49a6 c567 e530 b9bf 41a9  ..y>.JI..g.0..A.
000000b0: 61b1 4dcc 77a1 7a3a c5a8 cb6a 3008 5958  a.M.w.z:...j0.YX
000000c0: fc15 ff50 d515 e0b3 326f 44d7 aecf 32fb  ...P....2oD...2.
000000d0: 4050 03b0 3302 5e1c f038 1ea2 bf04 19f6  @P..3.^..8......
000000e0: a847 1a8a 2571 47a3 0c68 a6c6 4b5c 72ed  .G..%qG..h..K\r.
000000f0: e463 a51a 509b aae2 bd85 dc96 5ca7 dbb0  .c..P.......\...
00000100: a5af bddc 6b77 f9ef 020c 86c1 8bba 2734  ....kw........'4
00000110: 4cb6 20bb e2b6 68af ba5d 5d4a 44ce 73a7  L. ...h..]]JD.s.
00000120: 5c72 4ad8 1d3a 0eed ea63 9629 9c56 518f  \rJ..:...c.).VQ.
00000130: e51b 32fa 2f4f da18 3592 de3c 335d edae  ..2./O..5..<3]..
00000140: 1f1f cd86 bedb cb3b 44c5 cf91 8047 d8b4  .......;D....G..
00000150: 33c2 aeff eea6 3184 5332 09bb a051 1191  3.....1.S2...Q..
00000160: 18dc f1dc a3a5 4220 36d7 c95c 7bb4 fc2d  ......B 6..\{..-
00000170: a518 9d56 937d bb35 b962 2e6d bdb6 dc07  ...V.}.5.b.m....
00000180: 5b10 ca25 275b 2523 d57c 1363 5ad7 f9ca  [..%'[%#.|.cZ...
00000190: 249e 8ea2 83c6 6af4 3de3 1fea 15ba ec1d  $.....j.=.......
000001a0: e70c 96b8 38d8 b225 62a4 63d0 fa2e 5c72  ....8..%b.c...\r
000001b0: 6057 ecf8 3db2 9f7d 185c 72ee 8e5a e519  `W..=..}.\r..Z..
000001c0: 02db bfbb c25a c738 d2b6 b454 8d56 5ab6  .....Z.8...T.VZ.
000001d0: 11ae 27cc e476 81e8 2321 9135 c833 3a4b  ..'..v..#!.5.3:K
000001e0: 8a89 919e 26e8 3623 e44d aaec 59db 6f6e  ....&.6#.M..Y.on
000001f0: 79da 3941 29e8 d274 7eb6 0aac 3249 8b1b  y.9A)..t~...2I..
00000200: b25d 1ff1 c496 f75c d125 e2aa f3b4 21a0  .].....\.%....!.
00000210: 7a55 d31d 4939 8433 ea97 f927 f9f3 0954  zU..I9.3...'...T
00000220: a861 2baa 7568 e1ce d489 f59d 1365 a69e  .a+.uh.......e..
00000230: fc22 bef1 a0cc 7dfc a320 7ad5 fa39 3f5d  ."....}.. z..9?]
00000240: 16b0 58b0 253c c54b f4d8 5729 cfb6 2371  ..X.%<.K..W)..#q
00000250: c328 c5ab 1315 fcc2 27ad 8462 b5d5 d6f8  .(......'..b....
00000260: 76aa fb12 c775 1733 24df 98f9 dd86 cbbe  v....u.3$.......
00000270: 0c6e eb38 695f 705b 062d e231 3812 bdc4  .n.8i_p[.-.18...
00000280: 4664 ae0e 30a9 2cfb 3cf2 84dc 806e eb86  Fd..0.,.<....n..
00000290: 7988 d147 1bc9 f7b3 ad1f 1914 2d97 99c2  y..G........-...
000002a0: d096 711b 4f24 74d3 ebd9 8d11 7a4a 6518  ..q.O$t.....zJe.
000002b0: e25a 9c0c 79b2 661c 8188 6a88 7315 ed7e  .Z..y.f...j.s..~
000002c0: b7ce 6d18 b06a 34d0 0a89 de1c 0509 65b4  ..m..j4.......e.
000002d0: ae5d 303d d2f2 7e98 cf07 ebb6 a4c0 e311  .]0=..~.........
000002e0: 13c4 1133 9b69 ecb6 9da7 75c8 1806 c136  ...3.i....u....6
000002f0: 2531 acbe aaa1 9353 fa13 ff28 fa62 999b  %1.....S...(.b..
00000300: b59f f13d 47ca a7f5 e706 06f1 9374 78b1  ...=G........tx.
00000310: 649a ea19 a156 efe0 084a b06b 31c0 d86d  d....V...J.k1..m
00000320: c913 a3d4 dbb0 6248 851f 688f 11fb cd91  ......bH..h.....
00000330: f339 9fb9 c9fe 0ecc acfc 6eeb 1544 6469  .9........n..Ddi
00000340: 223c 5d5e 14bd caaf f3ca fc4c 6cc4 b2a2  "<]^.......Ll...
00000350: ade5 5656 df3f 7046 c9ab cd63 3c5a caf3  ..VV.?pF...c<Z..
00000360: eec4 23ce aeb0 5aa8 7273 c1a7 d5b3 627a  ..#...Z.rs....bz
00000370: 4b5b ec3b 7f87 48cb 5740 51d8 79aa f4cd  K[.;..H.W@Q.y...
00000380: 5315 f53b ed89 2d7f 5736 d4f4 12e1 f1a0  S..;..-.W6......
00000390: 7d5b f45b 8323 4bd8 37fb 173e ed3e e85d  }[.[.#K.7..>.>.]
000003a0: 7f82 e83d de15 2925 cbb4 702f 04c4 b8f0  ...=..)%..p/....
000003b0: 4998 b5f4 7ad3 b8f3 9ad3 5008 1722 c7ee  I...z.....P.."..
000003c0: ca10 40f2 3fb1 8f2b 2262 f70e 8358 c2ac  ..@.?..+"b...X..
000003d0: 0b78 4ca2 163b 2f74 3c02 df67 a4eb f9f9  .xL..;/t<..g....
000003e0: 799c b5c4 14b6 d672 54d5 37c3 6a7d 1675  y......rT.7.j}.u
000003f0: f219 bd6e ee58 eda8 3af1 6989 c8c9 f1a8  ...n.X..:.i.....
00000400: eeeb dcfa bed7 eef5 4ea7 50ff bde8 92f8  ........N.P.....
00000410: 6648 2980 ebf9 7645 84d9 0ef5 1192 c672  fH)...vE.......r
00000420: 254f e460 8da5 79d6 0fbc 2138 1edf b1ad  %O.`..y...!8....
00000430: 355a 98ab 548b db38 43ef 12db ef01 b93c  5Z..T..8C......<
00000440: 933a cbf1 44e6 2b85 f22c f6db e922 e1e3  .:..D.+..,..."..
00000450: 113e 803f 562c 83df 898c 3dca 86fc c809  .>.?V,....=.....
00000460: c09d 8585 87b0 4a78 8908 fc4f e0f3 4731  ......Jx...O..G1
00000470: 671f c4de 53f3 a85f 8954 fed5 ee2c 99c4  g...S.._.T...,..
00000480: f091 6feb 5307 4f70 7df4 2620 d7d9 dca4  ..o.S.Op}.& ....
00000490: 4644 a948 4016 44bc 80df 7d6f c686 6499  FD.H@.D...}o..d.
000004a0: a4bc 75d0 2506 bf1d 2747 6b54 95be cfb1  ..u.%...'GkT....
000004b0: 7b4b d70a 89b0 ac68 e2c4 1394 ba20 4d01  {K.....h..... M.
000004c0: 204c 64f3 721f 2a53 862d 89f5 59df b273   Ld.r.*S.-..Y..s
000004d0: 7c32 470f 7055 ef6e 2167 d4dd f546 9c0e  |2G.pU.n!g...F..
000004e0: 9eda bf3a 78ce d946 28b5 2c8d f79f 7c31  ...:x..F(.,...|1
000004f0: f940 d75d 8940 aca2 f6af f538 1eaf 6ef7  .@.].@.....8..n.
00000500: c81d 56c5 955c 0506 7474 fa7d 4627 b6fe  ..V..\..tt.}F'..
00000510: 4aa9 9abd 825d 166f 852c 8a4b b87e 727f  J....].o.,.K.~r.
00000520: 43c6 d657 eeb5 46cb 449b ce1b cc11 a25c  C..W..F.D......\
00000530: 72b1 8ccd 7feb ac50 8c21 a75c 30cb a3a7  r......P.!.\0...
00000540: ebc3 326c 0a9e 8b3a 513e 560b 2c31 cb61  ..2l...:Q>V.,1.a
00000550: c6bc 6748 90e1 6e3c ae15 8e37 9264 f73f  ..gH..n<...7.d.?
00000560: 696b 3c62 47a8 f091 82a7 0f4e 2f7d 1343  ik<bG......N/}.C
00000570: d202 b436 3e36 7825 7fc7 8b0b 2543 cdff  ...6>6x%....%C..
00000580: 2a33 08af e34a 652e d547 d87d 0c4f b6d8  *3...Je..G.}.O..
00000590: 5105 ad4b 47e9 31ad 2bec 98f0 d6aa 487d  Q..KG.1.+.....H}
000005a0: d26b 33fa 651c 67b7 f189 7c01 cf87 24ee  .k3.e.g...|...$.
000005b0: f2d5 3634 49f3 6aad 898c 914f e6fe 202d  ..64I.j....O.. -
000005c0: 8f18 2e3b a1dc fe8c 624c 3d66 27ca 54da  ...;....bL=f'.T.
000005d0: 1183 c790 96fa f357 bee8 6171 d69e 451d  .......W..aq..E.
000005e0: 5aad 5bd5 681a 0cc1 b6ce c3d4 82d9 d7a6  Z.[.h...........
000005f0: e269 4bac bbff c406 7388 85d6 6dda f2c4  .iK.....s...m...
00000600: 0f75 e17c dd1d acfd 6086 904c c59c 935b  .u.|....`..L...[
00000610: 0a8f cef8 c935 51ad d44a d9b2 aa0b e01c  .....5Q..J......
00000620: 3ff9 bb87 3190 b4cc 2fed 4bd1 58a1 f06b  ?...1.../.K.X..k
00000630: ee44 1a6c 435d ae3a e7ef a501 a30e 6def  .D.lC].:......m.
00000640: 21ea 3b89 32e1 631b 53f8 c14a f636 51f9  !.;.2.c.S..J.6Q.
00000650: d662 ef32 b386 ed27 6b87 5b5e 8f5b 9776  .b.2...'k.[^.[.v
00000660: dfe0 e83d 1f29 fbf2 dc5b b843 60bf cbc8  ...=.)...[.C`...
00000670: aa9a 9ad2 f94e 2ea9 96b0 296c 937e 65a3  .....N....)l.~e.
00000680: eafd a4d0 85b5 9f4a c671 7ece 5811 c7b7  .......J.q~.X...
00000690: d3c6 75e0 70b3 224d c9aa d8f1 fb6e f4ea  ..u.p."M.....n..
000006a0: 1d7a cef7 5fc7 5a98 7fd5 28b5 753f 7c43  .z.._.Z...(.u?|C
000006b0: da79 9d90 1a51 33ae ca7a d5ea a990 fed3  .y...Q3..z......
000006c0: 5ff5 2975 7b99 8333 44c2 a7fa 17a3 875d  _.)u{..3D......]
000006d0: 70ef 2361 6d5a 1cc8 13a7 d482 30c6 2b84  p.#amZ......0.+.
000006e0: 4d4a a765 c81b 2e16 3e62 08d8 ce5a 2beb  MJ.e....>b...Z+.
000006f0: a823 42ef 633f 7858 cdaa 755c 3097 f029  .#B.c?xX..u\0..)
00000700: 2afa 06d8 47c0 2714 f3fa 1554 d8a5 1a8b  *...G.'....T....
00000710: 77ac b319 ac47 9b5e 5ba7 a5ae 7dc7 c86f  w....G.^[...}..o
00000720: e73b 2a62 7a3e 7b29 6583 b227 0417 bb6e  .;*bz>{)e..'...n
00000730: 98ef 9097 6f9b c655 8f20 32ce a60e 6556  ....o..U. 2...eV
00000740: ce62 c8c9 afab c30e 6908 5675 19c6 5019  .b......i.Vu..P.
00000750: 62dd 131b 9c2d 3968 3f42 5b96 e7c9 1e23  b....-9h?B[....#
00000760: f1b0 0280 9ce9 f9cc 92ec 7eb5 a7c6 9619  ..........~.....
00000770: 5aab b832 b7cf 865c 72f1 9454 e33a 9975  Z..2...\r..T.:.u
00000780: 5b8a d8e8 5f46 0a22 2397 7d77 f70a 33b7  [..._F."#.}w..3.
00000790: 5183 5d5e 7267 54c5 a204 1e2f 470a dad2  Q.]^rgT..../G...
000007a0: a554 e493 7f06 7ff9 5fdd dfff 8428 a74f  .T......_....(.O
000007b0: 2727 272e 6465 636f 6465 2827 7a69 7027  '''.decode('zip'
000007c0: 295b 696e 7428 612e 7265 706c 6163 6528  )[int(a.replace(
000007d0: 275f 272c 2731 2729 2c33 3629 256d 5d3b  '_','1'),36)%m];
000007e0: 6d2d 3d36 0a09 7072 696e 7420 633b 672b  m-=6..print c;g+
000007f0: 3d63 3b61 3d49 2829 0a20 613d 4928 29    =c;a=I(). a=I()

결과

score is 2854, totalerr is 19482

9

파이썬 : 2006 바이트, 점수 = 1501

1885 바이트, 점수 = 1337

1961 바이트, 점수 = 1207

내 제출 내용은 다음과 같습니다.

import sys
b='eJwdVQuW4ygMvJdyGgwYtAGJQQKHOf2Wp9/rJqGxVaqP+HxUMlGx5F86/XoqsUuonzAz5cf5vqjJ6OlQudxOJR3ibJ8cwuSmsTX12daVht8ubj15miaEH/GrESXrQrXbl1K0m2hs6dRjMkp1PuS2/9JoVslkLmp2L6J6f5kij4s0nkSPni/5GZtixSuKcKd7lYvsfi7yNYxseKXqV6fURkc//KXe+P6Hc071xuZteixiSRtzMnavwNfqcydqSzb+9hMTlW/UQSNe5uRx1EVp1OhA7gXb0v+i0rKN1rYsGlWBufozlFbzP+i2KXCpNKNjfTwkytcBnv+OgoV6blJ/8NDjF6iqUd2ojqcbrScmIaurHJxs6yHjck96brZJwncsIOHhzwyemZurKFrkmpIX9yXSNGsKdF+F+rF2fam0+KAMj3YdoXFJR+nY7AL4y1jaopNuBhk6sl03pSd7x2IxoyeLO6dGedjp9V0inusji0EAyR4pBttN6dt+UR/SYBHCVwuxPZSvqNYpZhPIWXM3Segs30IFXKZKSzqDkcdORud59xVJ8o4WsJQelUqXnIAjV/2whDybo1mDmhYCeAjZV4552gSWOa5aSG3WZ0SaqZVe4Y+o7R+Ps5knum0pDGNxrKA3De3Lwo/si420aemw2g/tdq5sKN1HyltpLNeY/qPUYwsLatc/pwRq5eSwK4l5LhHEnSIZhhG9xsFqeqDMRctmTnVQRoamwUtloiLNrgV+a0uzHBKAyUYl61yD+m++GkgeW1eiuMDEoCR6504z32V9JHD25tPVHFyXOGOc+A2vABogIw9vfxWBatuHwaWggEELdS+8De8z7ZHhir70cLoQpYYDOgfMw+ASbrhnbrwQ27x4TNt/3qHBEPSmwzlagqlH5J4Bk2FBqEvc9fXORUnnnceiMAc2kALwNdOB4W87eAw2uAwsIncpu+IYutsJwsJ/JfusCZNipqyL8uwjNHuDN3MJQBSg/Sr1ppByfD9RWaAt/QhLGDDv2C1PxSvBbfyEFqNO5ZwZpE2yqd2PjEwueV1aJoBdGxNjSl8klx3nuWAAxgCxKePt0bykLrCcQWspM61K3qcNuJYa53VMBWKNJCsrYkzZGfZf49fotx3ZYURvyYQ+GR6iOVCfT6fB4hkehfOws/k3PjFo82ZgaE60TxccO4DqKEKDVXSsuknSmuzZwB8C+h7YBS3oaRPSyGvurfnNvM2bMustIxXMYsM/WdvAvLn8hIx5CMCJQxEM2P2yLuyWYHvZziC+T8IWooeMVWDnvoF6wcETdOUVYBFcFdCop/CJ07RpwyjNy1kslHYwdfNxGYGtX4lWduETDAFIeLJntoAk/sjHlLI5tIwp6mcLF5gxJOR2eugsO5/fey0EhMb72J+mrwyB3rkw2eT0cCPuAOUc5cw/b7mQi8942Eaig4nkYUE9xi3D+FTVRxd80XLL9MXhgISod0JBHxjPPCNirRsh/0TgWdrB/6u01zHbvUnBDc4yhknZxCXgrgSWdv8h1oQR3q8hjdbbE5zK6e4U9nhNkHxCwjCdN26sS9+BIMPe7+EDExPGccPLQYvC8+SY1ioz3AxVUWfdJi3RNjjEMyiWq31CjITE1cQPTO5En39bkFEzri7c2f8Dkow6qw=='.decode('base64').decode('zlib').split(';')
R=raw_input
def G(c):print c;sys.stdout.flush()
def P(w):
 if'END'==w:exit()
 d=b[len(w)].split(':');l=len(d[0]);p=f=0
 while p<l:
  G(d[0][p]);x=R();r=w==x;w=x;f+=r;p+=p+1+r
  if'_'not in x:return
 for c in d[p-l+1]+'zq':
  G(c);x=R();r=w==x;w=x;f+=r
  if'_'not in x or f>5:break
while 1:P(R())

점수 출력 :

score is 1501, totalerr is 21608

이 프로그램은 완전히 결정적입니다. 자이언트 블로 브 (64- zlib비트로 인코딩 된 압축 데이터 청크 )는 의사 결정 트리 (단어 길이 당 하나의 트리)의 목록입니다. 각 의사 결정 트리는 깊이가 2에서 5 사이 인 완전한 이진 트리를 인코딩합니다. 각 내부 노드는 단일 문자이며, 문자가 행맨 단어에 있는지 여부에 따라 결정됩니다.

이진 트리의 각 리프 노드에는 트리 검색의 해당 분기에 최적화 된 빈도 테이블이 포함되어 있습니다. 이 표는 특정 단어의 완성에 유리하도록 최적화 된 반면 다른 단어는 완전히 무시합니다 (제한된 "실패"예산으로 인해 도달 할 수없는 단어). 이 테이블은 오류를 최소화하도록 최적화되지 않았으므로 (상대적으로) 좋은 점수에도 불구하고 프로그램의 총계 수가 높습니다.

표시되지 않은 옵티마이 저는 랜덤 그래디언트 디센트 전략을 사용하여 주파수 테이블을 생성하는 비 결정적 비선형 옵티 마이저를 사용합니다.


5
1337은 좋은 점수입니다. 거기있어! = p
justhalf

골프를 원한다면 의 값을 실제로 사용할 필요가없는 range(4)것으로 대체 할 수 있습니다 . [1]*4i
user12205

@ace : 감사합니다. 네가 할 수있는 걸 잊었 어 (어쨌든, 난 그냥 최신 점수 향상을 위해 루프를 다시 작성 했으므로 모든 것이 이제 사라졌습니다 ...)
nneonneo

@ justhalf : 나는 그 점수를 좋아했지만이 점수를 계속 향상시키고 싶습니다. 덮을 땅이 너무 많아요.
nneonneo

1
Btw, 당신은 decode('zip')대신 사용하여 하나의 캐릭터를 면도 할 수 있습니다decode('zlib')
justhalf

5

루비

사용자 PragTob 와 본인 의 공동 제출 .

MAX_TURNS = 6

frequencies = {?t=>[3,48,145,214,252,266,249,223,191,142,63,44,16,1,0,1],?h=>[2,14,81,125,85,91,60,42,30,14,11,6,1,1],?e=>[5,49,260,316,456,408,328,279,202,125,50,32,12,0,0,1],?a=>[4,60,211,259,249,266,253,192,152,111,51,42,15,1,0,1],?n=>[4,30,120,136,214,252,238,214,189,128,59,45,16,0,0,1],?d=>[1,25,100,104,131,123,131,81,63,36,14,15,7,1],?f=>[2,13,51,58,64,67,41,40,28,18,11,9,3,1],?o=>[9,44,150,165,195,220,214,168,155,104,46,37,14,1,0,1],?r=>[1,25,140,246,312,310,263,206,150,95,45,32,11,1],?y=>[3,29,41,58,86,94,83,63,52,31,21,12,2],?u=>[2,23,67,117,126,154,107,97,85,48,27,16,2,0,0,1],?b=>[2,22,53,60,72,59,41,30,36,16,7,6,1],?i=>[3,38,143,179,223,299,270,241,205,134,64,44,16,1,0,1],?s=>[3,23,129,176,195,208,177,136,117,71,44,23,13,1],?c=>[0,12,68,122,146,194,180,163,130,85,49,25,7,0,0,1],?l=>[0,18,153,172,190,196,164,131,125,67,35,20,5,0,0,1],?g=>[1,19,42,75,82,104,78,60,39,30,12,10,0,1],?w=>[1,21,56,56,40,41,18,16,6,2,1,0,0,1],?m=>[2,10,77,68,119,94,104,76,68,45,15,17,8,0,0,1],?p=>[1,24,82,84,94,129,105,88,99,56,24,11,7],?k=>[1,6,65,37,28,24,6,10,3,4],?j=>[0,5,5,6,7,6,5,6,2,0,1,1],?x=>[0,6,4,7,15,22,13,16,9,9,2,2],?v=>[0,3,21,39,47,58,63,42,40,23,10,9,2],?z=>[0,0,3,3,3,5,2,3,0,0,1],?q=>[0,0,1,9,5,13,8,3,5,4,3,2]}

while !(input=gets.chomp)['END']
  current_turns = MAX_TURNS
  won = false
  chars = frequencies.keys.sort_by {|c|
    -(frequencies[c][input.length-2] || 0)
  }
  i=0
  while (current_turns > 0) && !won
    c=chars[i]
    i += 1
    puts c
    $stdout.flush
    old_input     = input
    input         = gets.chomp

    if input == old_input
      current_turns -= 1
    # else
    #   frequencies[c][input.length-2] -= 1
    end
    won = !input[?_]
  end
end

결과:

score is 625, totalerr is 23196

여기에는 1672 개의 문자가 있으며 아직 골프를 치지 않았으므로 알고리즘 개선을위한 충분한 공간이 있습니다.

먼저 단어 길이별로 그룹화 된 문자 빈도 (단어 목록에서 계산)의 해시를 저장합니다.

그런 다음 각 라운드에서 모든 문자를 현재 길이의 빈도로 정렬하고 가장 일반적인 것부터 가장 일반적인 것까지 시도합니다. 이 접근법을 사용하면 보통 중간 정도의 특성을 가진 모든 단일 단어가 실패합니다.


나는 이것이 최적의 해결책에 가깝다고 믿는다.
justhalf

@justhalf는 최적의 솔루션을 위해 너무 많이 ... ...)
Martin Ender

@ m.buettner +1 <필러 텍스트>
user80551

score is 625, totalerr is 23196여전히 최신 업데이트 된 알고리즘? 나는 비슷한 것을 시도하고 최대 300을 얻었다.
justhalf

1
@nneonneo 만약 당신이 justhalf의 초기 의견을 언급한다면 ... 그것은 약 3950 점을 얻은이 답변의 초기 (잘못된) 버전에 관한 것입니다.
Martin Ender

5

업데이트 @nneonneo과 유사한 방법을 사용하여, 나는이 코드에 도착 정확히 2,047 문자를 .

점수:

점수는 987, totalerr는 21964입니다

암호:

import sys,re
R=raw_input
F=';;;topenayr;elsatrodin;eatslroncih;eastrinclodu;etnocsiralupd;enostciarldpmu;eitnoasrclupmdy;einocstarlpumdyg;itacslnorepumdgyv;intaoslecrupymdgfh;nitaoerclsmudpygfvh;itneaorscmpdlfuvybh;ratdgfihosw;;ceimontalu'.split(';')
G=[''.join('.'*int(c)if i%2 else c for i,c in enumerate(re.split(r'(\d+)',w)))if w else''for w in 'eJwdlA2S4yoMhK+0CpPJ28ppQPxuQFBITMq3f52JXY5TdpC69TXP50ziQ6RWKxV3stBw+XEtIXXvx4u+g5I5e1x0V+fGN236S/b0aU+7UjMNFoyOvVc8hSInersrxBWr0BUqNSchUXT835YlWCyUTtW9Q6PL1UfhRtmVR3gm72dvu/Vts3c+sqPFoSaWbUWqqi9dylLXe65MWM12/CEdkcLX6LVXU7HBuQXSqDyMKTOjgX40Dty966CXY66Q2H/r7b3b7qat2zF8NLbWZ1QpTLvXWN+1NancuPdoE8sXNi1DqrtssxY+7RzRdxUWa5FLDVPzJJnWpTZW4xN4Uay1BFvUIxNKtz2le7/N47Bt3XedKjyttQgl/dhlcfvNZaNkFN8OnsrULiPQGqeeOsZRPZVl+sXsT61413rvqr751pbIBR/CSyWWs+JLrl66li+lM1j2JVDQowzxlUeo451DGDXOnDlD5Dw+7jcrnC855BmvCr8jGpzsa1P/E0VeWqKGwWGtEKVNiodj/4mTRXtgUDQChs4k7UWZ/py7ldsbv5WZ44ugjdj735MDzpFDffPgtQruJdO6vT7rVwYMQa+dCc7xCgVyJ57+65bH6yxj43/D7cxl3vaPAS/YEGfzo/Ess2iINV5To1/5VbMqrXMsV7ZYZJU1KPAZH4rrUNA/pK8MjlCcYAipoCYryaesw1wbD6SFb2+n7YfOZ6xexOb0RZv34Kprn743BtGwYsnZXbadfX3Yw8jAFGtbYGxxc1p08LF4bbbDdYdsvA7wyPUVm3GD70u9t9I9q8oAMUPbaVdV/oXKNwNUIkCCTDyAnd46e21yAyJQFFRn35+G5i97rXeZwuW+tcPYa0VesXNAXzguNviOKGEyEbYjkT56VehF14eRgNYHSjePNnl3L3CAJsMDhNhP072ng0sRvk0Gq0LeMHqRvRUj3/xQNwt3cyBiaEH0we28VZ4LMIse/O34T32sybiAlf1sCXHEzgUNU3wiqOt74zXdqc/pOpXC1UIffoyNUCAjiyfjFb8fehue6hbaPKjXgI4RwIVgBAmXeiC5J5ihGFZKnGAFxLF/WmpxJ6HPtuXTdM1D8m3iWfKPSQFKQPEdmSL/+WA7vItr9JuMKGWsi/7kTrzGLXDoPzvy/jjxq4gMi0E+87xnz7SS+p08EXbM7h32M5QOxRNk3py6TdrHd0kftelzravf4MDBcrCGWvJu4toejG9Ok75SffANw9hp3/6Osegr6L1hfx4YRXoCVUrkXbwFecx74on+P/VTUoewuekqaRrP5/N/1MpqAw=='.decode('base64').decode('zlib').split(';')]
while 1:
 w=R();i=0
 if'END'==w:break
 f=0;l=len(w);g=set()
 if G[l]:
  while i<len(G[l]):
   c=G[l][i];print c;sys.stdout.flush();g.add(c);x=R();i=2*i+2-(w==x);f+=w==x;w=x
   if'_'not in x or f>5:i=0;break
 if i>=len(G[l]):
  for c in F[l]:
   if c in g:continue
   print c;sys.stdout.flush();x=R();f+=w==x;w=x
   if'_'not in x or f>5:break


오래된 항목

결과:

점수는 656, totalerr는 22962입니다

이 알고리즘은 결정론 적이므로 평균이 아닙니다. 즉, 섞인 단어 목록에 대해 항상 같은 점수를줍니다.

다음은 Python 2.7의 항목입니다. 골프 (717 자)

import sys
class S():
 def __init__(s):
  s.l=6
  s.g=set()
  s.p=''
F=[0,0,'onastifeybhmudgkprw','topenayridsubwglfhcmkxjv','elsatrodinphmcukwbfgyvjxzq','eatslroncihudpgmfbywvkqxjz','eastrinclodumphygbfvwkxjqz','etnocsiralupdmgyhfbvwkxqjz','enostciarldpmuygvhfbwxqkjz','eitnoasrclupmdyghfvbwxkjqz','einocstarlpumdygvbhfxwqkj','itacslnorepumdgyvfbhxkqw','intaoslecrupymdgfhvbqxjwz','nitaoerclsmudpygfvhbqxj','itneaorscmpdlfuvybh','ratdgfihosw',0,'ceimontalu']
s=S()
while 1:
 c=raw_input()
 if c=='END':sys.exit()
 if '_' not in c:s=S();continue
 if c==s.p:s.l-=1
 if s.l==0:s=S();continue
 s.p=c
 for x in F[len(s.p)]:
  if x not in s.g:
   s.g.add(x)
   print x
   try:
    sys.stdout.flush()
   finally:
    break

이것은 @ m.buettner와 비슷한 아이디어를 사용하여 추측 할 수있는 정렬 된 문자 목록을 저장합니다. 그러나 이것은 빈도 데이터를 직접 사용하는 것이 아니라 거의 모든 가능한 문자 순열을 시도하고 게임을 시뮬레이션 한 다음 마지막으로 최고 점수를주는 순열을 취하는 것입니다.

이 버전은 상위 9자를 사용하여 최적화되므로 2 글자 및 3 글자 단어의 경우 이전 입력의 정보가 무시되는 알고리즘 클래스에서 순열이 이미 최적입니다. 현재 10 자의 글자로 된 코드를 계속 실행하여 4 글자 단어를 최적화하고 더 긴 단어에 대한 더 나은 해결책을 찾고 있습니다.


부적합한 입력

벤치마킹을 위해 전체 의사 결정 트리 인 11092자를 사용하는 코드가 있습니다.

점수:

점수는 2813, totalerr는 17539입니다

암호:

import sys,re
R=raw_input
F=';;;topenayri;elsatrodin;eatslroncih;eastrinclodu;etnocsiralupd;enostciarldpmu;eitnoasrclupmdy;einocstarlpumdyg;itacslnorepumdgyv;intaoslecrupymdgfh;nitaoerclsmudpygfvh;itneaorscmpdlfuvybh;ratdgfihosw;;ceimontalu'.split(';')
G=[''.join('.'*int(c)if i%2 else c for i,c in enumerate(re.split(r'(\d+)',w)))if w else''for w in 'eJw1momWqyyzhm8pgENc/9UoNGILSoto3Fd/nsq3zt49pBNlKKreAfzf//afbZycWkJQs6l+U8n4/smbKubuV9VNRZ3m7B/VFmNSpw41qPN/48+xn8/PcpbpnE5Vzzu7Oitnf9RtnsllFzb1TEEtZpt+lDP2fWx5o7FpjiqYe1rUY0I/20V5M/eT6r0956LmPKvJ+N+oNhP72Qd+f/pf1cZpYmihT6r1pg3RqWS9OkygzZUhx+PhUttX1S7TL28d2kSjbP6hg9hnWjBq6dV669NYF5jf2cfkGW/sg2q3+aM+Sk2qfYzabFS7yX1t+r0zy3TzV+o31V581pmkmqaoZs5FZXNIbD45q6wITrsaVcuih2Nojz22m1LDpnS/ptxmGUUx6tOZ3DTvRzVn0xevSzvQqD0O3RofMj/5bn/2S5lCl1rz66WbI/HJb3lapXL7Ggq/f0vh1c3VQ370q+luLjTp+/Mtb7zz/37GcY/LscTj3GO0dTvc6VI5t9Of2alQylpysVvI956J6JbPw12qJKemJsUQw1m2k2Avkyqu2HRa5a1lZWMtLvHqDol4WxtYoKhe52HP80jrOQeacFuu3qltruSXXeZpt5Pa/MJf28znLKnzTznIlUgLk9mcVZZoO09/Zus3rR83zZOV93nztE65krnfpWUKc1AnuVZNnlcyVXI3TMtC3pAeG2sXGNvSP056XMjodiuhTLNVU0p0cBQyiaV2XO7MJIucyDrPS4LPAlnLFLZVTesvozvXPN0ntzAn5jMd9By55lSnzWrKN2O/l9Ke/X0u5NYtueWmKSSG/SRJu2WdGFLuT4Kw/neBpQwCcy1Nv65bKLmqcEU6CK5+U0yCG+iIIU1B5uXlZTbq3mYaWXvHWI2ahzYET+QfZve08dHfqc0h25m6ctobe0cVuT0H/x0eKRkInQt6vX95J6u79f3mKHvd20k/uj+MTqty66ryercTmXz39q7fsN0MqITvPJ5v8i+rk0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L84/Quw/8jPkSCIe1R5Sd04nSFxOvIQ6dwLm99hLJl4/eGuE+g8YCJOLz2vmv3YPf2SyDxr1M2y92IkA1rU/knw+gPkvcvxwVU8ohOOYIYL4M1utv2qaUAKMIPeBOmkRwWTFzgTheU/Cvi6HKep/vtemrHU8JNuEhULrLqHI6cfRRI7YCe3R7PkiZPkre/5T1wJS9RAnSUdDEa5oBelyN7vOHFIzDTYIfG8Q4s0QuZdpIDKVaGEcqcMs/5p/Qr9okauLOkMXYQCNyWnxrFqwajhorvtyzEAawzlFMl6Ea+5zf+i2ts3noHklyRrNizRhsOAh7rg9/ocKU8uPwMzys/SW3/ZnV81PgGXxIcfPoQd4RjVTaRd5Sgs/+9MOoj+KHr4Phkbt985j8KZUPIYGo00cuGjWFW7J3Pc9jgfDCDAmT/1QBqg7eOfoT0LCLaF331q9sGu9RB63Jfvo8pCIjvOPiz85uWgvW5petswfSZdTmkCmzMjy2k896v5AG11fOSO7GRfuVP/9QoqxzAJ/Txk62UJ5Gu5gaqYbJKn8t0HZBGmLQcCiD0ygUqpsTejs+9Ik4ZtBy3FtQ7X1KrZSf32UXX/YED7spT7sqX7Abaenrd/bHysnFVIaJDF5oI0kePlJHUKgF4g+0L8O2XwMrTzmCqFl9xN/jqaRh2ddK1kJ0Pv4Y99DewyNPKN0RPyIgMp/G2z9IKfWiuV+/ve///0fiWqMOQ=='.decode('base64').decode('zlib').split(';')]
while 1:
 w=R();i=0
 if'END'==w:break
 f=0;l=len(w);g=set()
 if G[l]:
  while i<len(G[l]):
   c=G[l][i];print c;sys.stdout.flush();g.add(c);x=R();i=2*i+2-(w==x);f+=w==x;w=x
   if'_'not in x or f>5:i=0;break
 if i>=len(G[l]):
  for c in F[l]:
   if c in g:continue
   print c;sys.stdout.flush();x=R();f+=w==x;w=x
   if'_'not in x or f>5:break

2
나는 기능의 변화없이 527 바이트 코드를 golfed : gist.github.com/nneonneo/c9f3ef399f0c588634d7을
nneonneo

5

Perl, 1461 바이트, 점수 = 1412, totalerr = 21050

$|++;
while(!eof) {
  $l = $pg = '';
  %d = "[eaitrnoslcdupmhygfbvwkxjqz]<[scpardetmfbilwhognuvjkyqz]a[tlrncsidbpgmyuvkfwxzhoj]b[leoairusytjvmb]c[oetahiulrkcysq]d[eiaourlyvdgsmfwjnhqt]e[rnaslcdtmxevpfgqiwyobhkzju]f[ieoauflrty]g[erhiaunolygsmtdb]h[eaoituyrnldmbcw]i[notsclvdagrmefbpzxkuq]j[uoea]k[einaslywftogd]l[eyialoutdfvskcmpbwnr]m[eaipombuysnftl]n[tgedcsaionvufkylmhjqwxp]o[nrumlstwpocvdgfbaikyexjh]p[reoaliptuhsymdbfw]q[u]r[eaiotymdsruncgvklpbfwh]s[teisuhpoacmlykwfqndbr]t[iearhoyultcmwnsfbpg]u[rnstliceampbgdfyok]v[eiaoyu]w[aiehonrlsdtkfy]x[pctiaehuy]y[esomatpcwbildgrn]z[eoaiy]"
    =~ /(.?)\[(.*?)\]/g;
  %r = ">[etynrldgshmkpcwfoabxui]a[retclmnphisfvwbudgoxykjz]b[aiumoerylbhgspt]c[ienaouscrxtlyh]d[neairoludhsywgpk]e[rtldsvcmnphgefibkuwyzjox]f[eifnoalrustdmkwp]g[niaeroudgykt]h[tcsgwpenrxado]i[trsldnacmfhvpugwbekoxyz]j[nbdeao]k[carnosilewu]l[aeliobpuctfsrdgnwhkym]m[oeiarumstdynlghbp]n[oieaurngwkhtmsldy]o[icrplthmsfnobdwvgejyuzak]p[msaoepuixrlynt]q[eisncd]r[eaotpuigcrbdfhwlys]s[iesaunorbydclptmkgw]t[ansicreuolthpfxbygkwmd]u[ostcqlrfdbpagnmjhixev]v[ieoanrdlb]w[oaesrtydnlkph]x[eiaon]y[ltradcnsheomfbgpkuvzxw]z[iae]"
    =~ /(.?)\[(.*?)\]/g;
  while (<>) {
    chomp; last if !/_/ or /^END$/;
    $l++ unless /$pg/;
    last if $l>5;
    s/$pg//g for values %d, values %r;
    $_ = "<$_>";
    my %s;
    while (/([^_]?)_/g) {
      $x = $d{$1} || $d{''};
      $s = 180;
      for (split //, $x ){ $s{$_} += $s; $s -= 100 / length $x }
    }
    while (/_([^_])/g) {
      $x = $r{$1} || $d{''};
      $s = 180;
      for (split //, $x ) { $s{$_} += $s; $s -= 100 / length $x }
    }
    ($pg) = sort { $s{$b} <=> $s{$a} } a..z;
    print $pg, $/
  }
}

(여기서, 약간의 선택적 공백을 제거한 후 1461 바이트입니다. 인쇄 될 때 백 개 정도 무겁지만 여전히 2000 미만입니다.)

나는 더 많은 "미묘한"접근 방식을 시도했지만,이 방법으로 모든 것을 꺾었다. 두 개의 데이터 문자열은 단순히 각 문자 다음에 오는 문자와 각 문자 앞에 오는 문자의 순위가 매겨져 있습니다 (단어 목록에 전혀 표시되지 않는 digraph가 있음). <하고 >시작을 나타내는 단어의 끝에하는 데 사용됩니다. 예를 들어, "w[aiehonrlsdtkfy]""wi"가 "wi"보다 흔하고 "we"보다 흔하다는 것을 의미합니다. %d순방향 매핑에는로 저장된 전역 순위가 포함됩니다 $d{''}. 그것은 두 개의 미지의 행이 있거나 단어 목록의 모든 digraphs가 소진되는 곳에서 사용됩니다 (따라서 우리는 단어가 아닌 단어를 처리해야합니다).

단어에서 알 수없는 모든 위치에 대해 앞의 문자를보고, 각 가능한 다음 문자에 점수를 부여합니다. 최고 순위는 180에서 시작하여 목록 끝에서 80으로 감소합니다. 다음 문자에 대해 동일한 작업이 수행됩니다. 모든 문자에 대한 모든 점수가 합산되고 가장 높은 점수를 가진 점수가 선택됩니다.

문자를 추측 한 후에는 순위표에서 직접 제거되므로 다시 추측 할 수 없습니다 (새 단어를 시작하고 테이블을 다시 초기화 할 때까지).

업데이트 : 버그를 수정하고 (역 테이블에서 문자를 제거하지 않았 음) 목록을 내려갈 때 포인트가 떨어지는 방식을 변경하여 많은 포인트를 얻었습니다.


1
Digraphs를 잘 사용합니다. 이것은 내 솔루션이 ...이 접근법을 결합하여 실험해도 신경 쓰지 않는 방식으로 위치 정보를 이용합니까?
nneonneo

@nneonneo :) 재미
홉스

3

파이썬 : 2046 바이트, 점수 = 1365

점수는 1365, totalerr는 21343입니다

import sys
from math import factorial as f
z=lambda r,x:f(r+x)/f(r)/f(x)
d='eJxtVouWwygI/dYEV03rg5Fg63z9Apo+ZtczZ5JU5HG5gP+0cyvHlhjORrI6lQpnZoq0Z8o46GO5\noJ/YE8XwpBw6UXGEcLPdM2MacpBzO8kVcr1TSttJxx5/Rg/u7h5EDJlI/jgBiRkCO1sDuWUETVci\nxkxM+junUWBQF+OeSgxUxg+B+ExnbB2hgJxp8cR5fA/dT6U7q7+Ovhf8/ahIEWrGQyR3+3X8ORKY\nnvI48vw88jClT4IDh+fh4mMQ2Nn8cWyfxpkmspj73EXYD9sfxzkwP6GKYP7ya3lQ5ZgsD30lIM6n\nZKZPkYqQzyV9bkeGgbGKeMyfUcxj96UUHOoP/IwrngrDIHtswBqFQ+YTDpftHeshJKkggNNWXd7U\nU5yw4me818L5KDjD/Lv8jyC6XldyulpFzvswm4T6faiQy0K6JmTKRyEYgZ7hrWm+VjezxuH1tcPK\nBLA8sNq7f/mHXkV4NDfeFG/0Fgp3PZErqM4s+WEXKb+ZhBQqXrH6PdE+E0SjUGWJzwfNei8KwM2L\nDdObnZ+WEt+IGcQxc73QAcYSU6q+V2XPF3NxKnhHMb0Nwj2Tc2lcGR4XMGFxL3tjoRQVe5gBL/rA\nqHpaQZqizuyoMGv5MGfEx4Q6HNMhV/nTh0WF+js35a8RZHAGeqiyfTxY2kSW4yN40NK3wvTLkq7I\nk/4QVcJedkvanSsdBTPEnjEstrUs2FHyCO3Dj14HXeUNgmQS1wI4n9YhaT1egUmATRwABYwkd4tQ\ncCTWdqPiK5ssve67F1R6mUjznIMJJRZnv3/X8bXScmHZYiiTngWOIJCnHCjG+jZBv23gXsdOWpkX\n88IRd4FSMRW+CElyPYoEOMbes+IWG4Xo60PSaNrw6nZXjPMJPks+9lgHR41S+KutQOh6ViiiWdSL\nzI1etbyiz/3qJd8bK49tmakpe/F81vL0vUmUt7+tmDBtCtnCeG5v2cDy35IZTdtKpmQJh0yCdmmM\nWgAUcZ5crBA0nnY2bd32iySehf8Om0vHwPrMY78sPL97WZQKTtZDU0Mz64SRDYTJyo6B4qiojsog\nddZ9tH/vNKwtmUYVi0F4xFOtvFnFcNmSdBYZJenOacfqNc3mcJCJM+N34wUMG06oQmuOHH1BU+NU\nvXrSIc3asfhunl5kngmyCZ6pJ4lFN8CzTm33B24TVm06WoMVFoUcP7dfNaL/f3arAp6Ta0OSsgX8\nPuAsL8/5saVdRhS5hTlkG0nJhyal7kJXlrOATf5BG2j3xd4/EySk1aTElqLB3tOupqNr4aHd+wdq\nSNz0uhJA7iFkk1Gqp0mnG8k6gcyZq74XDbRp6ZxruSfLlx9Q1xZhHNq8pYgiti2AjHyItUme1fRO\n3S1l/EzGt/9b60aQ94vt8b/79vwoML/q15lP0sZlUDw3bQvGMJkjXfKtPT3Ny9VSYXix0E1dyf50\nYdbbJteynCo8esQcfqeUrTKklKQAuXSy3ndC+RMAvqVdXQH79Yxhee12LnBXr884xPqQtr8i1jvj\n4o4aWFNbZsxNPH2GWSX1IX1IwqlFDqILelFIesMRdwQEH2TqSdcq0yHWuxSpiakW5J6UJB2OJro3\nvULus01HDncbYPWRYORC/wJ6k9G1\n'.decode('base64').decode('zip')
D=len(d)
R=raw_input
def G(c):print c;sys.stdout.flush()
def P(w):
 if'END'==w:exit()
 i,l,X=0,'e',6
 r=x=''
 while 1:
  if l not in r+x:
   G(l);w=R()
   if l in w:r+=l
   else:x+=l;X-=1
  if not(X and'_'in w):return
  if l in w:j=1
  else:j=z(12-len(r),X)
  i=(i+j)%D;l=d[i]
while 1:P(R())

코드의 대부분은 nneonneo의 python 제출 에서 빌려옵니다 (2048 바이트 제한 아래에서는 이것을 얻지 못했습니다). 원래 나는 이것이 약 200 점을 더 받아야한다고 생각했지만 데이터 문자열 생성 도구에서 오류를 발견했습니다. 이제 내 점수가 1365보다 훨씬 합리적으로 수정되었습니다.

길이를 기준으로 이진 트리를 만드는 대신 빈도 정보를 보유 할 단일 이진 트리를 만들었습니다. 6 개의 부정확 한 추측보다 더 깊은 것에 대한 주파수 정보를 저장하는 포인트가 없기 때문에 나무는 균일 한 깊이가 아닙니다. 이 어색한 모양의 트리는 계승 코드에 의해 탐색됩니다 (실제로 조합 기능 사용). 데이터 문자열을보다 압축 가능하게 만들기 위해 사용되지 않는 모든 인덱스에 's'를 채웠습니다.

나는 스크립트를 사용하여 d로 저장하기 위해 좋은 문자열을 계산했으며, 누군가가 스크립트의 나머지 부분에서 더 많은 캐릭터를 골프로 칠 수 있다면 더 좋은 점수를 얻을 수있는 대체품이 있습니다. 맨 위 행은 위 프로그램에서 인코딩 된 문자열입니다.

score | length of encoded string | actual string
1365  | 1646                     | ertanialuctrssssvsnoctmushsbmsmpyssssssssssssdgyssspvlshgxsmgvssndspcjssssstmplyushumrtsdnsdvvsllatsibhqyvgdkdwssucmssmssulcsmusscsssssogsdssssssspsssstlsupmsusgsdsulyncysvyssfsnhgsnyqscalusthrvpcncpssrhtpsssspsbgvfsssssobuysssdssssssssssssssscsssssssssssscsssopshcompidssbsssssysssssssssssssssgusxsssimssssssimydssssxscipyfuydhwyscbssssmsssssssssssbssdsssusssssvspmvmssssspcbissssbyitypmxcossdmcssssssssssssyssssssosvssssfcvsssssdghsssssdsmpvysssssopcmtysssssstaimcyphocvshmsysssssssssshssssskssssssocdphsssuxhssssssiocyfsssswacubsssdpuutcidmsssdppoitanoclussaodmacssspdssssspmssssssssssssssssssspssssssnpbissssssssssssssssssssfqssgssssssfdssssssvbssspumbydmsssspbsssigsssdmgysrsdvminscygsxgssssssssssgsssssodbsssssugssssodbssbcssmsssscumsspomssssfssssssssppfssbcuyrdympysssssssrsssssfsssssgkmsssmocugssmcosudhsmdssssssssspsgopssssspssfblsbvssssssynsouqssfgusssvnisssjfpysfssssmdfssssrslujsuucpombssssnsicussssopssscssmossbsdsssssssssssspssssmdsfssssssssssssfsgdhwdssssdlyssksssssysgsssssogsusssssmfssusslsuufcpyssssvyssssscyodsssmsspusssssdpssssusslubuysuumppwsssgssgidsssssdoussssssssssssspdssssozsssssdssdrscmcdomsssgospdiwudspmidsygfcsulcuysssfssssusssssshucssssschgfcsssschbmsssskuosinpmchvmpgmssssssrmucpslfpcrsssssssssssvoyssscssssscopslsspgcdflssssssrucmfgssslcpruysclysssblsgsssssscilugsdslsssvssssssupvlysssssssssssssosssscssssslgsssssdcvysssspndcssssmcsssssssssssssssssssslsssssrugssssssucnmsssscncigdpslmgshhosssssossssszrypboybsyfssmdssssssgihbudsospdcusmosmoindflyybvmfcsshrsghfowsdphossspscssssssgsssssscgssssscfmspmbhoyuhssuplsbhsssvnitocnusmdcucfmjssspssssssssssssomvsshsssssspssssssssssssssussssrgssssssolmfbsydmssssdsssssrdpsjdssssssssssssssssplasssmyssssssdsssssamlssssfssssssssssssssmpdmsssflsssssdslpyhgsrdssssssshssdlshpssssfsrsssssshrsxssssmlavssdlsnpruupysdprdliypoxmybssssssssxpmsssssssssssshguslsyssslrpflsssdbmsrcdspvsssypsamssmhsblssfssdbssssmsssssfdasssalpmsssamsshglysusssshglyspdsssunalcosydslkulbpofmdssxssssgsgufsssssdyssssdssssusmysspmdssvmsssssivsssssmpohsssshgopsssssinocdusyspvssssvssssssssssrgyssspmsvlmsrvssscfulyusdfssssssssssssssssssrpssspssrgoyssssgmhssssssssssssvssssssupssssqbvysssussysssapsuoscpmhssssssssssssdsrsssxssssssalbhmssdmsssssscmphssslfgrmchdgvdsosucdssfwsacdhsmpvvmsssssssssssplslssshrlhssmssvlbyssshdrgwkmssqcoglurspvlgcllascyphoudsrpusylfgsssspblyssssssbssssssomsslussrmvlussssfycossssssosphyssrscgshpragcscbchoralpbyssbsvdyssssssuxlssdlsssssssssssssssssssssdsssussmbdsssssamhssssssssssssssdsssssssdpssssssssssfsgsssssdlussslsusopxasmdspmssscpovdussvyslssmssussssssdmssssuspdlsssmftdglasssmalatmlocwvhpmgzssssussssssnyshsmlsunvsvlysstcnssssssssssssssspsssussssssdoyssssssfysssssshgpssssssdbunckgsssthylssycsubdssssssndsvsssssslyssugssssowssjuspxgusssshowcnuysloncsupdgfdsslsstacnslusfghwdlsbnsssspsussbyscsubssssslcghslsvddsmhssssjulynbyssssphugkousssowlcymns
1381  | 1662                     | ertaniocvsplttushtpyutsudwbvumgdlatcpisppmgdsyusuqphplgpmypppplppppppuhslypppppppyvpppppsulcspommdbpppppppppppppppppppppnjpppppsgppppydncmpppppfsnhgpmuqycalinscyvpcncpppppspppppppppppppppppppposbpgpppisbhpmpgxyppppppodbdppppupppppvfpppppmulympppbusoybppfscipypslhppodbpdppppppffpppppppopfppppuppppypppmppppppppcbipppppyityfcvppppdmcpppppppppuvppppppppxbppppppocmxppldgmpyppppsmpobuppppopcmtypgpppstaimcyphpchmvxpppppplppppphpgpppkppppppocdphpppuxhpppppgiophyppppwacubpsdvmuutcivappubppoitanocluspaddmacopfpdgpppplvmpppppppppppppppppppuypppplpppppppgupppppppppppppbfqppsgpppppugpppppppvbbcpdmppppcumppbgpppppppppppprpppppmpppyppppppppppppppppppppppppppygnpppppppppppppppppppvpsfplmpyppppppppppppppbrpppxrdyppppppppppppppppppppppppppppppvyupsmpppppppppppppppcyppppcuypppppppsbpumpppspppfpsuqpgkmpponmocucuddpppcfujppmdcmcoprslujpuuppppppppbgppupppppppppppnupppfblsonppppppnsicupphbmdppppppppppppppfppppwdppppdlyppkppppppppppyppdspupdpppmfpbvpplsuppppyppgpppppogppghpppdspppuppgohdpspsdhpslubyppcumpppugppypppppufcpppvypppppyodpppppwppppppgidpppppdroupppppppppppppppppgozpppygdpppppcmcdompspfospdiwpuupmidpcppgfcpppppppppppgupppppucuhpppplchdigprmhchbmppcruuosinpmchvmpgmppdppppppppplppppplflpppppprucmfgppplcpruypbdspocgdpppppppppppppppkppblplfocdpppgxpppyppppppppppogppppcvpppplyupvlysgypppppcilybppplpcppppplgpppppdcvypppppndcrugomcpppppppppppppppppppslmphsoocdmsopppucnrypboxncigdpplmgppppppppouppppmzppppppvppppomybsdpuvgirsghfowpdcuppdppvindflyppvmfchbugdppfpcfoypgppoyuhsphopscxppppmpgoncusmpsspmbhppsupsuplbhppppvnitoclaspdcucyffqpppppppuppppppprjdpppppppomvppppppppdppppprdpppppppphsppppppmuppbpppppmyppuppsdpgsppfppolmfbppddmpppppppppmpppvppflsupppxpruyppppppppppppppppppppppppppmppppppspppppppuslpppdmlrshyppypppppmppppyhppppspafspppchpppppumpppppppmpppppppslpybpdlycsrcupsducymliypuyvybppppppppppppnpppmppdppmppppudnyoxmpmhglyppppuahglyfdapppunalcosyddlkulpuppmdpusppppvpppppppppppppppppppppbpofpppgufpppppppppppppppppppphpppppyppmdpmvpppppppsdypppsppdpprvpsvgrdgysgmrpppmpmppppxmpohpppphgopppqupinocdushppvscfurgoyfvlmfppppppmpgsppppyppppppmpxdpppbusmyppmsyypppppposcpmhsppppppppplypprpppvpppadppppppppdmppppppcmphhupgfgrmchppsalosucddpfwschdswppppxppppppddvgppluvmppprdgacdlpprvgxlfpprgwkpppphgglursplubcllascyphohmdfylppgfpcosulxpgplgpppbpbhmlvumppppvbrmyppufpyrypdpppppdosphyppgppfshpragcpvmchoralpbyppbpvdyppdplupppppmpppppdfpppppplpbypmppppppmbdpppppppppppppppppppppuppppplappppvllyppppamhspppppppppppppppppspplpppppsppppppfsgpppppdlupmppppsospxappppxuuppppppmmftpvplppppuvyppppumqppppmcpovudppddglanyppppatmlocsvotcnspppppxmgzpppppdlpppppplgpyvmwgpppbfyppphpphpgpppunpdbusvlypppthuglypncfbsppgpppwspuppppppdoypppppppppppfudppwgsdjupppcnuyppppsyupdfnpsoumytacnslupgghwdlpvlpsdpppppyoypppppxpppppphowlppypsoncvboculynbcsubpphuglcghpppplcymnpppdjdvalutcrspgppknmcpypowodppppguppppppbchgxpsysppoctmduppppsmpnryppppkppsyrhppppupprtsdnsuqlwp
1382  | 1796                     | ertaniocvsluuuuuluouuuuflbvuuuurucmfguuulcpruyubuuuuuudsuuuuupgohcuuuygnuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuyuuuuuybuuuuudmuuuuuuuuuuuuuouuuuusmuuuuuruguuuuosuuuuudmuuuuuuuuuuuusbpumuuusohuuupmrypblouoyfuuucnuuuuucfuuouupcnmoulonbuvuuuuuuybsduuusprsghuuuvqhopsuuuuuusonpuufownsicuudhbluvbuuuuuoyhuuuuuysfyuuuumpconcusmlxfmumcuuuuuuuuuuduuumuuuuuuuuuuuuuupuguuuuuoguuuuguuulrvmuuuuuuuuuuuuujvyuuduycyordpumuuuuguuuuuuuuuuuububuuusguuupwsduuuugidvbuuudouuuusdvmuugumyuuuuuufluuuuuopruyuuucdomuuuguspdiwuuupmiduumuuuuuusuuuuuuuusllpuuulrshcuuuuchidguuuuchbmuuuuuuosinpmchvmpgmuuuuuupydcumuuuslpybuugfvsrcdbuuccymcdyuuuuuuuuucgduuuuuuuuuuuuumpvuubluudncduuunhglyuguuuuhglyryguuuunalcosydulyupvuuumduuuuuuuuuuvuguuuuupvuuuuudcvkmuuupndcuuuumcuuduuuhmuuuulmpyuuduluuuuxucpmuuuuvucnmucyuxncimoculmgdurdgyuurpuuuufbuuuuugdpuuuumduuguzpgihbudvufpdcuuuurgoindflgkuvmfcpyuuuuuuuuuyuuymuuuucubvyuugsusyuuugsuuoscpmspmhbuuufusuplbhuuruvnitoclaumdcudmfuuuupcmphudugfgrmchuuuduosucduyfwschdswuuuuuuuuuspuuuuuulufcuuvrgdhuuuuprvuuuuuurgwkuuuuhgglurspyxpcllascyphoudsrpguusyguuuuuuuhguuuuubsuuuuupduuuuufmryuuuuuurypdulcuduosphypmuudfshprgfuucychoralpbyuuspadvyuuuuuuyuuuuubuuuumuuuuuuuuufsuuuuuuuuuuuuuuuuuuuukuuyuulfoyuuuuuuuuuuuuumuuuucmpuuucopuuuupgcuuuuuuuuauuuufdausuualpmuulduuuuusguuuuuuciluguuuluuuuuuuuxuumftuuuuuuuuuyuuuugsuuuuuuuuuuuuuuduuunusmyuupunvtymuyutcnsuuuuuuuumdsuuusvguuuusgmhuuymxuuuufyuuuuuuhpguuuuuqdbunckvlmuthugscfulfbsdfucpuwsuuuuuuuuuuyulyuuuuuuuuuuuuhwguuuuuuucnuyuuovuuupdfnuupluutacnsluuushwdaduuuuuuuluuuuyuuuuuuuhuuuuuxuuuuuualbhmuudvlynbuuuuuuhuguyuuuuudlcymnuvmuuuualcautlrsxgxnmcpyuhsuuuuuomduuuudsuuuuulhuuysuualvbyfughcossulquvdyluntryuuuufurtsdbfluuuomutsdyuxuuuvcyyrhtmuluguytnguuuuuuuuuuuuuuuuuuuushuuuudhpuuuufuuuuuuuuuuuuuuuuuuuumudluumbdupsluuuuliypoxmybuuuuuuuuuplauuuuvluuuuuuamhsuuuuuuuuuuuuuuuuuuuuluvuuuuuuuuuufsguuuuudluuuuuuusopxadbpuluuuuuuuuuuuuuuulubpofuuugufudmuuuuuupdluuuualdglahuuuhoatmlovavopmgzsdypuuuuuuuuuuuuuuuuuuuuuuuuuuivuuuuumpohuuuuhgopcuuuuinocdusyupvuuuucwhuuuguuuuuuuuuuuuuuuuuuuuuuuuuuufuduuuusdjuuuuuuuuuuuuuuuuspuuuuuuuucopuuuuguuuuuuulpsuuuuupypuuuuuuuuuuuuuuuuuuupsuuuuubocsuuuucsubuuuuulcghuyuuddvghuuuuuuuuuuuuuuuuuuklfuuuuowoduuuugusuuuubbchgxmpvuupoctmpuuuuusmpkuuuuuuuuuuuuuuuuusduuuuuusqulyuuusuquvuuuhltmpyuuuydtsubqlyuugdlatisbhdpmgdsuyuuuuuuuuuuuuuuuuuuuuudflyuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuslpbvfuuuuyuuuuuuuuuuuvuuuguvluudoupspumcopduuuuuuuuuuuuuuuuuuuumuuuydusuvydcuxpuuucoguuuuuuuumuuuuumuuuuulumquuuhgcpovdxyuuuuuubsouyuuuuscipyfuuvguuuuuuusuuuuuuuuuuuuubuuuuumuuuuuuuupmuuuuuuupcbhluuuuyityfcvuuuudmcuuuuuuuuuuusvluuuuuxbdoyuupocmxuuudghuuuuuusmpobuuvuuopcmsyuuuuustaimcythmlhmvuuuuuuuuuuuuuhuupuukuuuuuuocdphuuuuxhuuuuonuidouuuuuwacubuuupjgitcivauuudppoitanoclusuaddmacoufpduuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuusofquuuuuucvsyuuuuuuuuuuuuuuuuumyuuuupbspduuuhwkuuuurupcpmuuuusmvuuuuuuuuuuuuuuuuuuuujuuuuuysuuuuuususmcuuvuulcssfuucuuuuuuuuuuuuuuuubpuuudrdyuuuusguruuuuncyuhuuufsnhguuqyucalinscyvpcncvluuugpuuuupuumuuuuuuuuuuuuucugusuufuusuquuufguuuuodbuujfuuufuuuodmdfuuuurslujuuupbuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuopfuuuuuuuuumduuuuuuuuuuuuuufuuuuwduuuudlyuukuuuuuuuuuuuuvuuuuuuuuumfuuuuulsuuuupyumpyuuuuuuuuuuuuuuuuupuuuuuudpsuuuuuslubyuuuumpuuuuuuuuuuuguuuuuuuuuuuuuuuuuuuuuuuuuugouuuuuuuudruuuuuuuuuuuuuuuupubcuuumcygfcuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuugfcuuuuuuuuuuuuuuuuuuouuuuuuuduuuuuurmucpupupcrupuuuuuuuuu
1388  | 1800                     | ertanioclcpruyuuuuuuuuuuuuuuuuouugohucmfguuulbvuuuuuuygnuuuuuuuuuuduouuuuuuuuuuuuuuuuuuuuyuuuuuybuuuuvsuuuuuuuuuuuuuuouuubusmuuuuurugupmuoduuuuuuuuuuuuuuuuuuuuhsouuuusouuuuuurpsumbuuyfuuuuuuuuuuuuuuonuuuusvuuuuuycfuuuucybsonuduhrsghobdvqhodmouuyuuvuuuuufwduuupslhsonpuuuuunscifyohbuvsyfuuubuuooncusmpuuumucuuuuuuuuuuuuuuuuuuuuuuuulxuuuuuuunuuuuuuuuuuumudrjduuyoduuuuuuhouuuuupombugrduplvuyuufuuogiuuuuuubuuumumyuuuuusduuugufuuuuuupwuuuubugidsguumpuuuuufluuuvbuprdmuuuusdvmuxgduuuuuuucdomuuuuyspdiospupmimdusluuuuulrshyzuuuuucuuguuhucuuuuuchlpuuucuchbmuumuuuosinpmchvmpgslpybuumuusrcduuugchmcdbuucumuumuuuupyducvuuufluucgduuuuuudnyuuuuuhglybluuuuhglyrupvuuunalcosydulkuluuuhcduuulmupvlyuuuuuuuuuuuuuuuuuucuuuuulguuuupdcvyuuuupndcuuuumcuvyuuuxuuuupmuuuuuuulucyuuuccuyuurvucmnrdgyxncigdpfumguugkmuuuumocuguzduuuupvuuuuumrpuuuuugirhbududpdcufbluuuindflyuuvmfcoyuuuuuduuuuuumpyuuucuuoscpgsuuuuuugsuuuuuumspmbmhuufusuplbhudmuvnitoclaumdcucgrmchupfhuosucduufwschdswuuumpduuuuurgduuuluuuuudgrdhuuuuprvuuuusurgwkspuuhuglurspgyucllascyphoudsrpuuuuuguuuuuuuuvuuuusbuuuhguomuxufcurmyuuuuuurypduuuuudosphypduuufshpragcycycporalpbyuubgvdyuuuudsuuufsspamuuubuuumuuuuuuuuuuufuuyhuuuuuuuuuuuuuuuuuuuuuukuuuuuuuyuuuuuuuuuuuuvuuuuulfoyuuumpuuuuuuuuuuuuucsuuuucuaopuupxauuuualpmuuufduuuuuuuuuuuuugcumftusguuuuuuciluguuuluuuuuuuuuyuugsxunyuuuuuuunvtyuuuutcnsuupmdsuduuuuuuuuuuusmyuumuuyuusvgufyusgmhuhpmxuuuuudbunckguuuthuglquyufbsvlmuuuwsscfulyuydfuuuuuuuuuuuuuuuuuwguuuuuuucnuyuuuuuuupdfnuuuluutacnsluuughwdluuuuuuuuuuuuvypamovuuuuuuuuuuuuuuusmhduuuuulyhouuualbhuguxuuunbulcymnuuusyumalutcrsuuuvmnmcpyuacdlhsuxgxuuuudvguuuugvysuuuuulnrgsuulvonhcumdyflssyrhcosulubrtsdnquuuwlputsdyuuuyuucyyrhtmuuuuxuunguuuuuuuuuuguuuuuuuuuuuuuuuuuuuuuuuuuuuuuuduuuuuuuuuuuuuuuuuhpuuuuuuuumuuuuuumbduuuuuuuuudluuuuuupsluuuuliypoxmybvluuuuuuamhsuuuuuuuuuuuuuuuuuuuuluuuuulmfbuuufsguuvuudluuuuuuusopxauupuldbuuuusuuuuuuuuluuuuuuuuuuuudmuuubpopdlugufaldglafdmualatmlocwvhpmgzuyuuuuuuvushuuhusdypuuufgyuupuuuuuuuuuuuuuuuuuivuuuuumpohuuuuhgopuuuuuinocdusyupvuuuuuuuuuuuuuuuufduuuuguuuuuusdjuuuuuuuuuuuuuuuuuuuuuuuuuucopuuusguuuuuuulpsuuuuupyuupuuuuuuuuuuuuupuuuyuuuuuubocsuuuucpsuuuuuulcghuuuusdvguuuuuuuuuuuuuuuuuuukowduuuowuuuuuugulfuuuubchgxuuuuupoctmuduuuusmpksuuuuubuuuuuuuuuuupuuuuuusqulyuuusuquuuuuhltmpyuuuydtsulpmuuugdlatisbhddkgdsypblvmpuuuuuuuuuuuuuuuuuuuluuuuupmuuuuudflyuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuvfuuuuuuuuuuuuuuuuuuuuguuuuudouuuuumcopduuuuuuuuspuuuuuuuuuuuuuuyduuuuudcuuumuucogusuvyuuuxpuuuuuuuuuuuuuumuuhuumuuuxylumquubsocpovduscipyfuuvguuuuuuyuuuuuuuuuuuuuubusuuuuuuuuuuuupmuuuuumupcbiuuuuuyityfcvuuuhdmcuusvlyuuuuuuuuuuuuuxbuuuuupocmuuuudghdoyuuusmpobuuuuuopcmtyuuuuustaimcyphshhmvuuusoumyuuulyhuuvuukuuulyuocdphuuhuxhuuupxuiophyhowlwacuboncvmuutcivauuudppoitanoclusuaddmacoufpduuwuuuuuuuuuuuuuuuuusyuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuufquuuuuuuuuuuuuuuuspduuuuushuuuuluupbuuuuuuuuuuuygruuuvpmuuuymgvuuuuupcjuuuuusduuuuuuuuuuuuuuuuuuuumuuuuuuyvuuusfusucmuuuuuulcspuuucbruuuurdyuuuuuuuuuuuuunyuuuuusguuuuuuncyuuusmfsnhguuqyucalinscyppcncpuuumupuuuuuuuuusuuuuusuquuufgguuuuuuuujfuuufuuuuumdfuuuurslujuuupuuodbuuuuuuuuuuuuuuuuuuuuuuuuuuuuodbuuuuuuuuuuuuumduuopfuuuuuuuuufuuuuwduuuudlyuukuuuuuuuuuuuuuuuuuuuuuumfuuuuvlsuuuupyuuuuuuuuuuuuuuuuumpyupuuuuuudpsuuuuuslubyuuuumpuuuuuuuuuuuuuuuuuuuuuuuuuuuguuuuuuuuuuuuuuuuuuuudruuuugouuuuuuuuuuuuuuuuuuuygfcuuupubcuuumcouuuuuuuuuuuuuuuuuugfcuuuuuuuuuuuuuuuuuuuuuuuuuuduuuuuurmpucuuupcruuuuuuuuuuuuuuuuupuuuuuuuuuluuuuuufluuuuuur
1392  | 1848                     | ertaniocvslogppppppppppppppppppppppppppvypppppcyopmppmppppppppppdppppuprvppuprdgyppwrpppppgidpppppdouppppppppppppmppppppozpppppdrgoypcdcmopfpmppspdiwpdhdmidfpmpopppkbvypppspsyupppppposcpmhppchuppppppchbrmpmppuosinpmchvmpdmlpppppcmphpppgfgrmchpppdposucdpplwschpslhbppppfpcgdppppyplpppppprdgppblpprvcdpppprgwkpppphgglurspgypcllascyphoupsrvlypppgppppppppppvpppbppplgcolmpdcvyrmyppndcurypmlvmppdosphypppppfshprauypcyccoralpbyucnmvdypxncigdpblmgpsgpdppppppmpppzpvbpppdmppppsdvmpxgfgihbudppppdcuplppppindflyppvmfgvppppdppppppppgpppppcppppppgspppslpgsppppppmspmbhpppfpsuplbhppppvnitoclaumdcufmtppppppdpcumppppppppppppugpvpdppppnvtypmppmnybcppsptcnsppppppppvppvpppppppppppppphypppgupfyplmpyphpgppppppdbunckghgxthuglyycpfbsppppppwspppppppppppppvyppppppppppppwgpppppcycnsucuypppupdfnpppppptacnslupsphwdlpppymocugppgkyppppyhppppppuppppampsmhpppppflynbppppuyhugpppppppplcymnpppmpppalutcrspppppnmcpypfbppppppppppfdappppalpmyspxppppnryppppdsnhcmappppssyrhpppxppprtsdnapppwpyutsdgspppppcyyrhtmppdypppusmypppmdspvmghppupppppufcppdpppppsvgppppsgmhpppmxppppppppppppppupppppqupppppvlmgppppscfulyupdfppppppsppppppdpppppppppppppppppppplcppppgfpppppudvppppsbppppppppppppppppppppadpppppppppppppppppppphuppppxspppppalbhmppdvppppppkppppplfyoppppdvgppppvmpppppcacdlpcoxgxpppgcppppppppppppppplhppppplvbylypmdylsgpgfpcocisulxpllgpppfpppppvppppppppppppppppppppgppppppppppppppppppppppppppppppppppppppppppppppdpppppppppppppppppppppppppppmppppppmbdpppphpppppppppppppppppppppplappppvlppppamhspppppppppppppppppppplppppppppppppfsgppgppdlulugpppsopxapppplppppppppppppppplpppppuppppppdmpppppppdlpphoaldglappppalatmlocwpvpmgzpomvppvppppppphppppppppppppphupppppolmfbppdmpppppppppppppppppppppppppppppppgpppppppppppppppppppppppppppfudppppsdjuppppppdmpppppppppppppppppcopppppgpshpppplpuslppppypppppppppppppppppppphpppppphdlppppyliypoxmpblcowkdgpppppppppppppppppppppppppppppcshgpppppdguppvppppchgxppppppoctmppdbppsmusppppppppppppppppppdupppppsbpofpppsdylpppphlduymppppptsubqlypppplatisbgupmgdsusdypppfyvpypppppppppppppppppppivpppppmpohpppphgohpppppinocdusyppvppppupppppvfppppppppppppppppppppgpppppdopppppmcopdppppppppppppppspppppppppydpppppdcppppupcogupppppppppppppppppppppppppppsuppppxyppppppbsouyppppscipyfppvgpppppppppppppppppppppblfppppuppppppppmsppppbupcbimpvppyityfcvppppdmcppppppppppppppppppsxbppppppocmxpppdghpvppppsmpobpppppopcmtypppppstaimcyphpchmvppppppppppppphpppppkppdflyocdphpppuxhppppppiophyppppwacubpppvmuutcivapppsppoitanocluspaddmacopfpdpppvluppppspppppbplyppppppppppppppppppmppppppsuvypppxpuppfqpppppppppmpppppmppppplumqpppggcpopvdupppppppbppprpppppmpppypppppppppppspppppppppppppppppppmppppppppppppppppppsfhlpppsvlyppppppppppbrpppprdypppppuppppppdoypppppppppppppppppppsmpppppvppppppsyupppppsoumyppplypppppppppsppppdsuqpphfguppppxpppjfphowlppppmoncupprsldfppuppppppppppppppppppppppppppppppujppppppppppppppppppmdppppppppppppppfppppwdvsypdlyppkppppppppppppppppupspdpmfpushplsulpppypppppppppppygppppvlpppupmgvpdpsppcjpslubyppuumppppppppppppppppmupppppyvppppppsucmpppppulcsppppcdrppppppppppppppppppppnypppygsgfcppppncypppppfsnhgppqypcalinscgfpcncpppppppppppppppppcpppppdpppppprmucpppppcrppppppppppyppppppppppppodbylppppppflpppppprucmfgppplcpruypypppppppppppppppppppopfppppppppppppppppppppppppppppppoppppppppppppppppppppypuvppybppppppppppppppppppppompyppsmppppprugppppodmppppppppppppppppppphsoppppsopppppprypbopppyfppppppppppppgpouppgomoppppphwdpppppybsdpppgprsghfowdqmcopppppppppppppppppppcubppppcfoyppppoyuhpppppsfyppppmpconcusmppfmumcppppppppppppppppppppppppppppppppppppppppppppoppprjdbvppppppppppppppppdppppprdpppdsppppppgohcpppygnbppppmypppppsdpppppfpppppppppppppppppppppmppppppflpppppppruypppppppppppppppppppppppuppmppppppspppppppuslppppplrshyppppsbpumpppppppppppppppppponppppcumppppcfpyducpcnuslpybbmkfvsrcdvppccymcdyonphoppppppombppppsonppppmpnsicupudhuvbppnhglypppnyphglyrpppppunalcosydplkulppppmdpppppdppppppppppppppp
1396  | 1865                     | ertaniocvsluuuuuuuuuuuuuuuuuuuuuuuvyupmucyoduuuuuuuuuuuuuuurvuugurdgyuuurpuupwuuuuuugiduuuuudouuuuuuumuuuuuufuuuuuozrgoyuduukgucmcdomudmuospdiwuuupmiduuumfouuuuusyuuuuuuuoscpmhhucuuuuuchdigurluchbmuuuuuuosinpmchvmpgmdrcguuuuugrmchuuuuuosucpmufwschdswuudulbuuupslhucgdduuuuuurdgyuuuuprvbluuuurcluuuuxhgglurspyuuuulascyphovdsrpuupvllxuuugduuuuyuuubuuucumomulguuurmdcvuuuurpndcuuuumosphyulvyufshpragcucychoralpcduubuvducnmuuguxncigdpulmguubmuuusguuuuuuzuuuuupvvbuuudmuuuusdgiuhgbduupdcuuuuuuuindflyuuvmfcuuuuuuvuuuuuuuguuuuucuuuuubgsuuuuuugsuumvuumspmbhuuufusuplbhuuyuvnitoclmftdlucyfquuuuupuuuubcucumuuuuuuuuuuunyuuuuuuunvtyuuutcnsuuuuuuuuuuuuuupuuuuuuupvuuuyuuuuuufyuuhuuuhpguuuulmdbunckguuuthuglyycafbsuuuuuuwsuuuuupyuuuuuuuuuxuuuuuuuuvywguuuuuudcnuyuuuusyupdfnucyluutacnsluupghwdlspafuyhuugkmuyuumocugudmduuuuuuuuusmhuuuuuulynbuuuuuuhuguuyuuuuulcymnuuuuuuualutcrsumpuunmcpyuuuuuumuuuuuuuauuuffdauuysalpmubnryuuuudunhcuuuuuussyrhpuuuuuurtsdnuuuuwuputsdyxuuyugcyyrhtmuuuuuuunguuuuusymuupmdsuvmuusuduuuuuuuuuudufcuusdghuuusgmhuuumxuuuuuuuuuuuuuuuuuuuuquuuuuuvlmuuuuuscfulyuudfuuuuuuuuuuuuguuuuupduuuuuuuuuuuuuuuuuuuulcuuuugfuvuuuudsuuuusbuuuuuuuuuuuuuuaduuuuuuuuuuuuuuuuuuuuhuuuuuxuuuuuualbhmuudvuuuuuuuuuuuuukyuuulfdvguuuuvmuuuuuuacdlucuxgxucopuuuupgoyuuuuuuuulhuuuuulvbycuumdylyfugfucosulxuvciluguuusguuuuuuuuuuuuuuuuuuuuuuguuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuduuuuuuuuuuuuuuuuuuuuuuuuuuumuuuuuumbduuuuuuuuuuuuhouuuuuuuuuuuuplauuuuvluuuuuuamhsuuuuuuuuuuuuuuuuuuuuluupuuuuuuuuufsguuuuudlusuuuuuspoxauvuumuuuuuuuuuuuuuuuluuuuuuuuuuuudluuuuuulafuuuugudglaouuuuuatmlocwvopmgzuuuuuupomvuuuuhuuuuuuuuuuuuupuuuuuhhuuuuuolmfbuudmuuuuuuguuuuuuuuuuuuuuuuuuguuuuuuuuuuuuuuuuuuuuuuuuuuufuduuuusdjuuuuuuuuuuuuudmuuuuuuuuuuucopuuuuguuuuuuulpsuuuuhpyuuuuuuuuuuuuuuuuuushyuuuugybocsuuupcsubuuliylcghybuuddvguuuuuuuuuuuuuuuuuuukowduuuowuuuuuuguuuuuuubchgxuuuuupoctmpuuuuusmpkuuuuusuuuuuuuuuuuuduuuuuusqulyuubsuquuuguhltmpyupoydtsubqlyuugdlatisbhdpmgdsypdxuuusdyuuuuuvuuuuuuuuuuuuvuuuuuuuuivuuuuumpohuuuuhgopuuuuuinocdusydpvuuubvfuuuuuuuuuuuuuuuuuuuuguuuuudouuuuumcopduuuuuuuuuuuuuuuuuuuuspuuyduuuuudcuuuuuucoguuuuuuuuuuuuupuuuuuuuuuuuuuhuuuuupsuuuuuuubsouyuuupscipyfuuvguuuuuuuuuuuuuuuuuuuuubuuuuuuluuuuuuupmuuuuuufpcbibuuuuyitpmvuuugudmcuuuuuuuuuuuuuuuuuuuuuuuuuuxcyouuuufycvuuususmpsblyuuuopcmtyuuuuustaimcyphvmhmvuuuuuuuuuuuvuhuuulukuuusluocdfuuuuuxhuuuuuuiophyuuuuwacubuuuvmuutcivauuudppoitanoclusuaddmacoufpduuuuuuuuuuuuuuuuspuuuuuuuuuuuuuuuuuuuuuuuuuumlyuuuusuvyuufxpuuuuuuuuuuuuuumuuuqumuuuuulumquupbgcpovduuuuuuuruuuupmuuuyuuuuuuuuuuuuuuuusuuuuuuuuuuuuuuuuuuumuuuuuuuuuuuuusfuuuuuhluuuusvlyuuuubruuuurdyuuuuuuuuuuuuuuuuuudoyuuuuuuuuuuuuusmuuuuuuuuuuuvuuuuuusyuuuuuusoumyuuulyuuupuuuuusuquudfguuuhwuuuujpxuufuuuhomdfuuuuosrpndcuuduuuuuuuuuuuuuuuuuuuuuuuuuuuuuuvuuuuuuuuuuuuuuuuuulujuuuuuuuuuuuuuuuuuumduuuuumpcuufuuuuuuuuuuuuuuudguuuuluuuuuudrunhuupuuuuuuuuuuuuuuulyyguulumcuuumrfuuuuslcnvcypypuuuuuuuuuuuuuuuuuuuuuuuuuuuuupjuuuuuupyvuuuuululcsgfyuubuuuuuuuuuuuuuuupuuuuubyuuuuusguuuuunncyuuudrfsnhguuqyucalinscyvpcncyluuuupuuuuuuuuuuuuuuuuuuuuuuugupcruuuuuuuuuuuuuuuodbuuuuuuuuuluodbuufluuuuuurucmfguuulcpruyubuuuuuuuuuuuuuuugfcuuuuuuuopfuuuuuuuuuuuuuuuuduuuuuurmucpuuuduuuuuuuuuuuuuouuuuuybuvuuuuuuuuuuuuuuuuuuouuuuusmpyuuuruguuuuodmuuuuuuuuuuuuuuuuuuuhsouuuusouuuuuurypbouugyfuuuuuuuuuuuuuuouuuuumouugouhwduuuuuybsduuugprsghfowduhospuumcouuupbcuuuuuuucuuuuuucfoyuuuuoyuhuuuuusfyuuuumpconcusmpufmumcuuuuuuuuuuuuuuuupuuuuupuuuuuuuuuuuuuuuuuuuuuuuuurjduuuuuubvuuuuuuuuuuduuuuurdpuuuuuuuudsuuuuupgohbuuuygmyuucuusduuuuufuuuuuuuuuuuuuuuuuuuuumpuuuuufluuuuuupruyuuuuuuuuuuuuuuuuuuuuuuuuuumuunuuusuuuuuuuusluuuuulrshyuuuuuuuuuusbpumuuuuuuuuuuuucuuuuuoumuuucuupyducfuuuslpcnuuufvsrcdvuuuybmcdyuyhgkbuuuhouuuuupombuuuusonpuuuuunsicuuuhbumbuuuuuuuhglyruuuumunalcosyluykuluuuuduuuuuuuuuuuuduuuuuuuuuuuuuuuuuuuug
1402  | 1909                     | ertaniocvslpppkgpwppppppgidpppppumfoppuppsyppppppposcpomhppppdpppppzmcdomrpppospdiwpuupmdmipppfocmphpppgfgrmcupppdposuchphfwchcdswpppcmpoppppiuosinpmchdgpgmpppppvprvpppppdrgwkpppphgglurspyppcllascyphoudsrdscgppgppppppppppppppblppppcgpplpppprmypppppprypddlbppdsophlypupcfshprafcppymcoralpbyvlbpvdlglyppydcvypppppndcppppmcpppppppppppgpppppppplppppppcdppppppucnmppppxncigdpplmgppppppppppplpxpzppppppvpppppmdpppsppgihbudpvbpdcuqpppmpindflyppvmfcpuupppppppmftpgvmpppcdmpppusdgugxgpgscpyuppuspmnyplyfpsuplbhppppdnitoclaumvcucyfqpbhppppppppnvtypppmvfpvpppjdpbcupppppptcnspppppsthugllypppbspvppppppubcppcumpppppppppppppppppppwghppppppcubckgpxppupsycmlppnltacnspvppdhwdlppmpppphppppguppplmpypppppupppppppsmhpppxpplynblupppphugppppspamlcymnmppppvyalutcrsfyhppnmcpyppcyppppcuypppppppppppppyuspppfpnrypgkmpfnhmocugudssyrhpdpmppprtsdnppppwpputsdypppyppcayrhtmpppppppngpfblppppppppppppypppppppppppppppppmpppppppppppppppppppppuappppfdappppulpmpppdapppppppppxppppgspppppmdspdmsgmhpppplusmpppppppppdsupppppqupppppvlmpppypscfuufcldfppupgpppppppppppppyppppppppppppppppppppppppppppppvpgppppppppppppppppppppspppadpdpppppppppppppppppphulcppxpgfpppaludsppdvsbppppppppppppbhmpppdvgppppvmppppppacdlpppxgxppppppkppppppppppppplhppppplvbypplmdylfvpgfpcosulxppplgppppppcoppppppgcpppppppppppppgpppppfoypppplypppppsgpppppccilugppplppppppppppdpppppppppppppppppppppppppppmppppppmbdppppppppppppppppppppppppppplappppvlppppppamhspppppppppppppppppppplpppppphoppppfsgpppppdluppppppsopxapppplppppppppppppppplpppppuppppppdmpppppppdlppppamdglappspalatmlocwvhpmgzpspppppppppppphppppppppppppppppppppppppomvpppppppppppppppppppppppphspppppppgppppppppppppupppppgspppppolfudppdmsdjupppppppppppppppppppppppppmbpppppgcoppppplpsupppppyppppppppppppppppppppypdmpppbocsppppcsubppppplcghppshddvgphpppppfpppppppppppkowdpppowppdlppgupupslpbchliypoxmpoctmpypbppsmpkppppppppppppppgxppduppmppsqulypppsuqpvppphltmpyuppydtsubqlyupgdlatisubppmgdsuypppppppppppppppppbpofgufmppppppppppppppppppphppmppyppppppvpppppppsdyppppppdopppppppppppppppppppibhppppmpohpppmhgopppvfpinocdusyppvppppppppcopdpppdyppppppcogupppppppppppppppppppppppppphppppppxyppspppbsouyppppscipyfppvgpppppppppppppppppppppbppppppuppppsuppmppppppppcbipppppyityfcvppppdmcpppppppppppppppppppxlfbppppocmxpppdghppppbusmpompvpppopcmtypppppstaimcyphpchmvppppppspppppphpppppkppppppocdphpppuxhppppppiophyppppwacubpppvmuutcivapppdppoitanocluspaddmacopfpdpppppppvppppppppppppppppppppppppppppppppslpbyppppppppppppfqpppupppppvlupppppflyppppppppppppppbppppppppppspprpppspmpppyxpupppppppppppppppppppuvyppppumqppppmcpovdupppppppsfpppppppppppppppppppbrpppsrdyppppppppppppppppmpppppppppppppppppsmphlppppsvlyppppppppppppppppppppppppupppsppdoysuqpppfguppppppppjfpppfpppvpmdfppsyrslujpsoupppuplyppppppppppppppmypppphwppppppxpppppphowlpppmdoncvsyppfdppppfppppwdppppdlyppkppppppppppppppppupppppmfppppplsuppppypppppppppppppppppppuppupppppdpspppppslubyppuumpspdppppushpppplpppppppppppppppygppppvlpppppmgvppdrppcjpppppsdppppppppppppppygfcppmupppppyvppppppsucmpppppulcspgfccppppppppppppppppppppppnypdpppsgprmucpncypcrppfsnhgppqypcalinscyvpcncpplppppppflpppppprucmfgppplcpruypbppppppppppppppppgpppppppppodbpodbpppppppppppppppppppoppppppppppppppppppppypppppybppppopfpppppppppppppopppppsmppppprugppppodmpppppppppppppppppuvhsoppppsopppppprypbopppyfmpypppppppppppouppppmoppppphwdpppppybsdpppgprsghfowdqhospgpppppppppppppppppcppppppcfgoppppoyuhpppppsfypppompconcusmppfmmcouppppppppppppbcppppppppppppppppppppppppppppppppprjdppppppppppppppppppdppppprdppppppppppppppppppppbpppppmypppppsdpppppbvppppppppppppppppppppmppppppflppppppprsdhppyggnpppppohcpppppppppppuypppppsppppppmuslppppplrshypppppppppppppppppppppppppppcppppppumuppppppyducvpppslpybpppfvsrcdpppccsmcdyppyppppppppppppppppubpppompppppcfudnyppcnuhglynbmkpphglyrpppppunalcosydplkulpombmdppsonppppppnsicdpphbuvbppppppppppppppppppppppppppppppppppppppppppppppppuppppppppppppppppppppmpppppogrdypprppppppppppppppppppppvypppppcyodpppmfppppppprgoy

데이터 문자열을 생성하는 데 사용한 스크립트는 여기에 있습니다 . 누군가에게 유용 할 수 있습니다!


불행히도 공식 스코어러를 사용할 때 중단됩니다. 어떤 의미에서는 실제로 5 개의 잘못된 추측 만 얻는다는 점을 명심하십시오. 여섯 번째 잘못 추측하면 즉시 잃게됩니다.
nneonneo

@nneonneo 아 알았어, 고마워! 이 문제를 해결하고 갈 수 없으면 삭제하겠습니다. 내 수동 테스트에서는 여섯 번째 잘못된 추측이 손실 될 것으로 예상하지만 결말 조건에 문제가있을 수 있습니다.
tttppp

디버깅에 도움이되는 몇 가지 추가 정보를 추가하기 위해라는 단어가 제공되면 distinct프로그램의 출력은 순서대로이므로 eitanogsuc5 번만 잘못 추측하더라도 출력 제공이 중단됩니다.
user12205

@ace Brilliant, 감사합니다. 매우 도움이됩니다.
tttppp

@ace 다시 테스트 해 주시겠습니까? 나는 올바른 지점에서 잃어버린 "고유"를 수동으로 테스트했습니다 (또한 "잃어버린"문어 ",이기는"귀 "및"끝 ")도 테스트했습니다. 감사!
tttppp

1

D 프로그래밍 언어는이 문제에 대한 선택의 나의 도구입니다.

바이트 카운트 다운을 얻기 위해 일부 부분에서 약간 골프를 치기는하지만 2,048 바이트 제한을 부끄러워하지만 모든 무거운 리프팅은 완벽하게 읽을 수 있습니다. 이 솔버는 그 일을 잘하지 못하고 쉽게 이길 것이라고 기대하지만 이것은 공을 굴리는 것입니다. 말하기 위해 물건을 걷어차십시오.

편집 # 1 :지적했듯이, 원래의 코드는 모든 모음을 다 쓸 때 끔찍한 죽음을 겪기 쉽습니다. 제대로 작동하지 않기 때문에 임의 추측에 대한 좀 더 잔인한 접근 방식으로 대체했습니다.

편집 # 2 : 원래 코드가 수정되어 이제 서 있습니다.

점수 :

25.7; totalerr: 24,529.9 (average of 10 tests).

작동 원리

이 솔버는 완전히 무작위입니다. 임의성조차도 임의의 재미있는 시간입니다!

프로그램이 입력을 받으면, 아직 추측하지 않은 임의의 한 문자를 추측하여 STDOUT으로 보냅니다.

추측 알고리즘은 다음과 같이 작동합니다.

  1. 두 문자 그룹 (자음 또는 모음) 중 하나를 임의로 선택하십시오.
  2. 다음 두 모드 중 하나를 임의로 선택하십시오.
    • 문자 빈도 사용RNG에서 를 가중치로 . 더 높은 주파수가 선택 될 가능성이 높습니다.
    • 빈도를 무시하고 임의의 인덱스에서 문자를 선택하십시오.
  3. 2 단계에서 선택한 모드에 따라 단일 문자를 반환하십시오.
import std.stdio, std.random, std.array, std.math, std.algorithm;

alias double[char] Hash;
alias uniform U;

bool first = true;
Hash cons, vowel;
char[] guessed;
Mt19937 rng;

int fails;

void main()
{
    rng.seed( unpredictableSeed );

    auto get() { return stdin.readln.replace( "\r", "" ).replace( "\n", "" ); }

    string input, last;

    while( ( input = get ) != "END" )
    {
        if( first ) last = input;
        if( input == last && !first ) ++fails;

        if( fails == 6 || !input.any!( x => x == '_' ) )
        {
            fails = 0;
            last = null;
            guessed = [];
            first = true;
            continue;
        }

        stdout.writeln( guess );
        stdout.flush;

        if( !first ) last = input;
        if( first ) first = false;
    }
}

char guess()
{
    reroll:
    Hash group;
    double min, max;
    bool useWeight = U( 0, 2, rng ) == 1;

    if( guessed.filter!( c => vowel.keys.any!( x => x == c ) ).count < vowel.length && U( 0, 2, rng ) == 1 )
    {
        group = vowel;
        min = useWeight ? 2.758 : 0;
        max = useWeight ? 12.702 : 4;
    }
    else
    {
        group = cons;
        min = useWeight ? 0.074 : 0;
        max = useWeight ? 9.056 : 20;
    }

    double choice = U!( "()" )( min, max, rng );
    char chr;

    if( useWeight )
    {
        foreach( k, v; group )
            if( v < choice )
                chr = k;
    }
    else
    {
        int counter = 0;

        foreach( k, v; group )
        {
            if( counter == cast( int )choice.floor )
            {
                chr = k;
                break;
            }

            ++counter;
        }
    }

    if( guessed.any!( x => chr == x ) || chr == char.init )
        goto reroll;
    else
    {
        guessed ~= chr;
        return chr;
    }
}

K keys( K, V )( V[K] a )
{
    K[] ks;
    foreach( k, v; a )  ks ~= k;
    return ks;
}

static this()
{
    cons = [ 't': 9.056, 'n': 6.749, 's': 6.327, 'h': 6.049, 'r': 5.987, 'd': 4.253, 'l': 4.025, 'c': 2.782, 'm': 2.406, 'w': 2.360, 'f': 2.228, 'g': 2.015, 'y': 1.974, 'p': 1.929, 'b': 1.492, 'v': 0.978, 'k': 0.772, 'j': 0.153, 'x': 0.150, 'q': 0.095, 'z': 0.074 ];
    vowel = [ 'e': 12.702, 'a': 8.167, 'o': 7.507, 'i': 6.966, 'u': 2.758 ];
}

@ace 모든 모음을 다 사용한 후 끝없이 다시 롤링되는 루프에 빠진 것 같습니다. 나는 왜 지금인지 확실하지 않지만, 제곱을 얻을 때까지 덜 복잡한 버전을 편집했습니다. 모음 / 자음 추측을 다시 게시하거나 게시하지 않을 수 있습니다.
Tony Ellis

dmd 컴파일러를 사용하면 오류가 발생 ./test.d(44): Error: cannot implicitly convert expression (uniform(0, Letters.length, rng)) of type ulong to int합니다. 에 의해이 문제를 해결했습니다 cast(int). 10 회 실행 후 평균 점수는 24529.1 개의 잘못된 추측으로 22.4 단어입니다. 더 고급 버전을 고치면 다시 테스트하겠습니다 :) 재미
user12205

@ace 생각보다 훨씬 낫습니다. 하아. 어쨌든 "똑똑한"추측은 이제 고쳐졌지만, 정직하게 말하면 그것이 깨졌을 때 더 잘 작동했음을 알 수 있습니다.
Tony Ellis

지금 점수가 몇 점입니까?
justhalf

@justhalf 점수 = 25.7, totalerr = 24529.9 (평균 10 테스트)
user12205

0

자바 스크립트 + HTML 솔루션

<!DOCTYPE html>

<head>

    <title>Hangman Game</title>
    <meta charset="utf-8">

    <style type="text/css">

        *{

            font-family: sans-serif;
            color: teal;

        }

        #man {

            float: right;
            margin-left: 0%;
            position: absolute;
            top: 20px;
            left: 50%;

        }

    </style>

</head>

<body>

    <div>
        <h1>Welcome To Hangman!</h1>
        <h2>Your current word to guess is: <span id="word"></span></h2>
        <input type="text" name="letter" id="letter">
        <h3>You entered the letter: <span id="chosenLetter"></span></h3>
        <h3>Incorrect Letters: <span id="incorrect"></span></h3>
        <h3>Chances Left: <span id="chance"></span></h3>
        <h2>Game Status: <span id='gameStatus'>In Progress</span></h2>
        <img id='man' src="../images/hangman/white.PNG" />

    </div>

    <script type="text/javascript">

        var word = document.getElementById('word');
        var input = document.getElementById('letter');
        var displayLetter = document.getElementById('chosenLetter');
        var chanceDisplay = document.getElementById('chance');
        var gameStatus = document.getElementById('gameStatus');
        var image = document.getElementById('man');
        var incorrect = document.getElementById('incorrect');
        var list = ['apple', 'banana', 'elephant', 'fruit', 'pencil', 'boomerang', 'trophy', 'slippers', 'university', 'curtain','connection', 'grandmother', 'inflation', 'recording', 'conversation', 'king', 'reception', 'distribution', 'cigarette'];
        var imagesList = ['white.PNG','one.PNG','two.PNG','three.PNG','four.PNG','five.PNG','six.PNG','seven.PNG','eight.PNG'];
        var imagesIndex = 0;
        image.src = "../images/hangman/" + imagesList[imagesIndex];
        var currentWordIndex = Math.floor(Math.random()* list.length);
        var currentW = list[currentWordIndex];
        console.log(currentW);
        var wordLength = currentW.length;
        var chances= 8;
        chanceDisplay.textContent = chances;
        for(i = 0; i < wordLength; i++){

            var nodeDash = document.createElement('span');
            nodeDash.classList.add('dash');
            var textNode = document.createTextNode(' _ ');
            nodeDash.appendChild(textNode);
            word.append(nodeDash);

        }
        var dashes = document.getElementsByClassName('dash');

        input.addEventListener('keyup', function(){

            event.preventDefault();
            var alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
            if(event.keyCode === 13){

                var letterChosen = input.value;
                input.value = '';
                var match = 0;
                var checkLength = letterChosen.length;
                if(checkLength === 1){

                    console.log('length is correct');
                    var checkIfLetter = 0;
                    var checkIfCorrect = 0;

                    for(i = 0; i < alphabet.length; i++){

                        if(alphabet[i] == letterChosen){

                            console.log('is an alphabetic letter');
                            match += 1;
                            checkIfLetter++;
                            displayLetter.innerHTML = letterChosen;

                        } 

                    }

                    if(checkIfLetter == 0){

                        displayLetter.innerHTML = 'Not A Single Letter';

                    }

                    if(match == 1){

                        var checkIfDone = 0;

                        for(i = 0; i < (1 + currentW.length); i++){

                            if(letterChosen == currentW[i]){

                                dashes[i].textContent = ' ' + letterChosen + ' ';

                            } else{

                                checkIfCorrect ++;

                            }

                        }

                        for(i = 0; i < currentW.length; i++){

                            var temporaryCheck = ' ' + currentW[i] + ' ';

                            if(dashes[i].textContent == temporaryCheck){

                                checkIfDone++;

                            }

                        }

                        if(checkIfDone == currentW.length){

                            gameStatus.innerHTML = 'GAME ENDED: YOU WON!';
                            gameStatus.style.color = 'lightgreen';

                            for(i = 0; i < dashes.length; i++){

                                dashes[i].style.color = 'lightgreen';

                            }

                        }

                        if(!(checkIfCorrect <= currentW.length)){

                            incorrect.innerHTML += (letterChosen + ', ');
                            chances--;
                            chanceDisplay.textContent = chances;
                            imagesIndex++;
                            image.src = "../images/hangman/" + imagesList[imagesIndex];
                            if(chances == 0){

                                for(i = 0; i < dashes.length; i++){

                                    if(dashes[i].innerHTML == ' _ '){

                                        dashes[i].innerHTML = ' ' + currentW[i] + ' ';
                                        dashes[i].style.color = 'red';

                                    }

                                    gameStatus.innerHTML = 'GAME OVER: TRY AGAIN';

                                }


                            }

                        }

                    }

                } else{

                    displayLetter.innerHTML = "Not A Single Letter";

                }

            }

        });



    </script>

</body>


1
PPCG에 오신 것을 환영합니다! 이것은 행맨 게임처럼 보입니다. 불행히도 문제는 행맨 솔버 (사용자가 플레이 할 수 있도록하기보다는 행맨을 재생하는 프로그램)를 작성하는 것입니다.
OOBalance
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.