Autogram checker: Difference between revisions

m
→‎{{header|Phix}}: removed misleading character counts, which included spaces and punctuation
m (→‎{{header|Phix}}: removed misleading character counts, which included spaces and punctuation)
Line 242:
<span style="color: #7060A8;">assert</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #000000;">2</span><span style="color: #0000FF;">..</span><span style="color: #000000;">3</span><span style="color: #0000FF;">]=</span><span style="color: #008000;">". "</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #000000;">4</span><span style="color: #0000FF;">..$]</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">shorten</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"characters"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">4060</span><span style="color: #0000FF;">)})</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">actual</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">255</span><span style="color: #0000FF;">),</span>
<span style="color: #000000;">claimed</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">255</span><span style="color: #0000FF;">),</span>
Line 300:
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000000;">diff</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">" (differences: claimed:%s, actual:%s)"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">claim</span><span style="color: #0000FF;">,</span><span style="color: #000000;">act</span><span style="color: #0000FF;">})</span>
<span style="color: #008080;">elsif</span> <span style="color: #000000;">check_letters</span> <span style="color: #008080;">then</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">lc</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"out"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">" -:,'."</span><span style="color: #0000FF;">))</span>
<span style="color: #000000;">diff</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">" (%d letters)"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">lc</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Autogram? %t%s\n\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">autogram</span><span style="color: #0000FF;">,</span><span style="color: #000000;">diff</span><span style="color: #0000FF;">})</span>
Line 306 ⟶ 309:
{{out}}
<pre>
This sentence employs two a's, two c's, two d's, twenty-eigh...y-three t's, six v's, ten w's, two x's, five y's, and one z. (259 characters)
Autogram? true
 
This sentence employs two a's, two c's, two d's, twenty eigh...y three t's, six v's, ten w's, two x's, five y's, and one z. (259 characters)
Autogram? true
 
Only the fool would take trouble to veriverify that his sentence...hensstrophes, seven hyphens and, last but not least, a single ! (456 characters)
Autogram? true
 
This pangram contains four as, one b, twtwo cs, one d, thirty ...n ts, two us, seven vs, eight ws, two xs, three ys, & one z. (268 characters)
Autogram? true
 
This sentence contains one hundred and nninety-seven letters:...ix u's, seven v's, four w's, four x's, five y's, and one z. (295 characters)
Autogram? true (197 letters)
 
Thirteen e's, five f's, two g's, five h's, eight i's, two l'...welve t's, three u's, four v's, six w's, four x's, two y's. (166 characters)
Autogram? true
 
Fifteen e's, seven f's, four g's, six h's, eight i's, four n...ouren s's, eight t's, four u's, three v's, two w's, three x's. (150 characters)
Autogram? false (differences: claimed:':0 ,:0 , actual:':14 ,:13 )
 
Sixteen e's, five f's, three g's, six h's, nine i's, five n'...hreeen s's, eight t's, three u's, three v's, two w's, four z's. (149 characters)
Autogram? false (differences: claimed:x:0 z:4 , actual:x:3 z:1 )
</pre>
7,804

edits