'"" "" "'" "'" "" "" "'" "" '"" "" ""' "" '""' "" "'" "" "" "" "" ""' "" "" "" "" "" '"" "" "" "" "'" "" "" "'" ""' "" "" "" "" '"" "" "" "" "" "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" """ "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" " '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" "" "'" "" " "" "" '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" """ "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "" "" "" "" "" '"" "" "" "" "'" "" "" "" "" "" "" "" ""' "" "" "" "" '"" "" "" "" "" "" "" " "" '"" "" "" ""' "" "" "" "" '"" "" "" "" "" "" "" "" "'" "" "" """'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" ""' "" " "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" " '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" ""' '"" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" "" "" "" " "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" '"" "'" "" "" "" "" '"" "" ""' "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" """ "'" "" "" ""' "" "'" "" "" "" ""' "" "" "" '"" "'" "" "" "" "" '"" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" "'" "" '"" "" "" "" "" "" "" "" "'" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" """ "" '"" "" "" ""' "" "" "" "'" ""' "" "" "" "" "'" "" "" "'" "" '"" " "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" " '"" "" "" "'" "" '"" "" "" "" "'" "" "" "'" ""' "" "" "" "" '"" """ "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" " '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" "" "'" "" " "" "'" ""' "" "" "" "" "'" "" "" "'" "" '"" "" "" ""' "" "" "" "" "'"" "" "" ""' "" "" "" "" '"" "" "" "'" "" '"" "" "" "" "'" "" "" "'" " "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" ' "" "" "" "" "'" "" "" "'" "" '"" "" "" ""' "" "" "" "" '"" "" "" ""'" "" "" "" "'" "" "" "" "'" "" "" "" "'" "" "" "" '"" "'" "" "" "" "" " '"" "" "" ""' "" "" "" "" '"" "" "" ""' "" "" "" "" '"" "" "" "" "'" "" " "" "" '"" "" "" "'" "" '"" "" "" ""' "" "'" ""' "" "'" ""' "" "''"" "'" ""' "" "'" ""' "" "'" ""' "" "" "" "" "'" "'" "'" "'" "'" "" " "" '""' "" "'" "" "" "" "'" "" "" "" '""' "" "'"' "" "" "" "" "" '""' ' "" "'" "" "" "'" "'" ""' "" '"" "" "" "'" "'" ""' "" "" '"'" "" """" '""' "" '"" "'" "" "" "'" "'" "" '"" "" "" ""' "" "
Explication
Ce programme est équivalent à un pseudocode comme celui-ci:
while (cp = (ch = read)) + 1 {
(
(cp -= 65) ? // A
(cp -= 4) ? // E
(cp -= 4) ? // I
(cp -= 6) ? // O
(cp -= 6) ? // U
(cp -= 12) ? // a
(cp -= 4) ? // e
(cp -= 4) ? // i
(cp -= 6) ? // o
(cp - 6) ? // u
0
: 1
: 1
: 1
: 1
: 1
: 1
: 1
: 1
: 1
: 1
) ? ((--vs)+4) ? print(ch) : (++vs) : {
print(ch)
vs = 0
}
}
avec les affectations de variables suivantes:
0 (unused) (13 bytes)
1 cp ( 4 bytes; occurs 20× in the code)
2 vs ( 7 bytes; occurs 5× in the code)
3 ch (10 bytes; occurs 3× in the code)
Comme vous pouvez le voir, j'ai évité l'emplacement variable 0 car 0
c'est une constante si longue à écrire.
Nous lisons donc chaque caractère et stockons la valeur dans cp
et ch
. Nous allons modifier cp
mais garder ch
pour que nous puissions l'imprimer si nécessaire. Nous soustrayons successivement les nombres 65, 4, 4, 6, etc. de cp
pour vérifier s'il s'agit de chacun des 10 caractères de voyelle possibles en ASCII (notez que le tout dernier n'a pas besoin d'être une affectation).
vs
contient toujours 3 de moins que le nombre de voyelles pouvant encore être imprimées. Il commence à 0
, donc 3 voyelles peuvent être imprimées. Quand il atteint -3
, nous arrêtons d'imprimer les voyelles.
Si nous rencontrons une non-voyelle (y compris l'espace), nous exécutons print(ch)
suivi de vs = 0
. Comme vous l'avez probablement deviné, cela réinitialise le compteur de voyelles.
Si nous rencontrons une voyelle , nous exécutons ((--vs)+4) ? print(ch) : (++vs)
. Décomposons cela:
- décrémenter
vs
;
- si la valeur est maintenant
-4
, nous sommes allés trop loin, alors n'imprimez rien, mais vs
revenez à -3
ainsi nous continuerons à refuser d'imprimer les voyelles;
- sinon, imprimez le caractère.
aaYYAAaaaAERGH
.