Dal momento che doveva davvero essere fatto, eccolo qui. È stato davvero un brutto debug e ha fornito alcune sfide.
L'input deve essere solo in lettere maiuscole. L'output è unario (spero che sia OK?)
J K ZZZZZZK Z ZD ZB ZZZZZZZZZZZZZZZZZA K A Z ZD ZB ZZZZZZZZZZZZZZZKF K A Z ZD ZB ZZZZZZZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZZZZZZZ K A Z ZD ZB ZZZZZZZZZZZZZZKD K A Z ZD ZB ZZZZZZZZZZZZZD K A Z ZD ZB ZZZZZZZZZZZZZD K A Z ZD ZB ZZZZZZZZZZZZ K A Z ZD ZB ZZZZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZKA K A Z ZD ZB ZZZZZZZZZKF K A Z ZD ZB ZZZZZZZZZZK K A Z ZD ZB ZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZB K A Z ZD ZB ZZZZZZZZKD K A Z ZD ZB ZZZZZZZK K A Z ZD ZB ZZZZKB K A Z ZD ZB ZZZZZZKF K A Z ZD ZB ZZZZZZB K A Z ZD ZB ZZZZZFB K A Z ZD ZB ZZZZZA K A Z ZD ZB ZZZAK K A Z ZD ZB ZZZ K A Z ZD ZB ZD K A Z ZD ZB ZKB K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K A ZKA ZZZZZZZZZZZZZZZZZZY
Provalo online!
Il processo generale è:
- ottenere carattere dall'input
- sottrarre 65
- controlla se il risultato è 0
- se 0 salta la quantità specificata di parole.
- altrimenti sottrarre 1 e ripetere il controllo.
- i target di salto sono operazioni di stampa push seguite da un loop back all'inizio del programma.
Termina con un errore.
Una spiegazione più completa:
J K ZZZZZZK Z ZD # Get input and subtract 65
ZB ZZZZZZZZZZZZZZZZZA K A Z ZD # Character A - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZKF K A Z ZD # Character B - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZB K A Z ZD # Character C - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZ K A Z ZD # Character D - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZKD K A Z ZD # Character E - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZD K A Z ZD # Character F - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZD K A Z ZD # Character G - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZ K A Z ZD # Character H - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZB K A Z ZD # Character I - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZKA K A Z ZD # Character J - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZKF K A Z ZD # Character K - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZK K A Z ZD # Character L - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZB K A Z ZD # Character M - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZB K A Z ZD # Character N - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZKD K A Z ZD # Character O - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZK K A Z ZD # Character P - if 0 jump to print, otherwise subtract 1
ZB ZZZZKB K A Z ZD # Character Q - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZKF K A Z ZD # Character R - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZB K A Z ZD # Character S - if 0 jump to print, otherwise subtract 1
ZB ZZZZZFB K A Z ZD # Character T - if 0 jump to print, otherwise subtract 1
ZB ZZZZZA K A Z ZD # Character U - if 0 jump to print, otherwise subtract 1
ZB ZZZAK K A Z ZD # Character V - if 0 jump to print, otherwise subtract 1
ZB ZZZ K A Z ZD # Character W - if 0 jump to print, otherwise subtract 1
ZB ZD K A Z ZD # Character X - if 0 jump to print, otherwise subtract 1
ZB ZKB # Character Y - if 0 jump to print, otherwise subtract 1
K ZZZZKF KF # Jump Point for print 1111111111
K ZZZZKF KF #
K ZZZZKF KF # Jump Point for print 11111111
K ZZZZKF KF #
K ZZZZKF KF #
K ZZZZKF KF # Jump Point for print 11111
K ZZZZKF KF # Jump Point for print 1111
K ZZZZKF KF # Jump Point for print 111
K ZZZZKF KF # Jump Point for print 11
K ZZZZKF KF # Jump Point for print 1
K A ZKA ZZZZZZZZZZZZZZZZZZAAAA # Jump back to start