Bacon cipher: Difference between revisions

Content added Content deleted
No edit summary
Line 537: Line 537:


=={{header|Lua}}==
=={{header|Lua}}==
Based on C++ version
<lang Lua>
<lang Lua>
function Bacon( txt, secret, e )
function Bacon( txt, secret, e )
Line 644: Line 645:
end
end


local a = Bacon( "one morning, when gregor samsa woke from troubled dreams"..
local a = Bacon( "Chase the pig around the house present belly, scratch hand when stroked. "..
"When in doubt, wash jump around on couch, meow constantly until given food, "..
", he found himself transformed in his bed into a horrible "..
"favor packaging over toy. And sometimes switches in french and say 'miaou' "..
"vermin. he lay on his armour-like back, and if he lifted "..
"just because well why not has closed eyes but still sees you lick yarn hanging "..
"his head a little he could see his brown belly, slightly "..
"domed and divided by arches into stiff sections.",
"out of own butt so pelt around the house and up and down stairs chasing phantoms.",
"Fall over dead, not really but gets sypathy", 1 )
"This is a Bacon cipher test", 1 )
print( a )
print( Bacon( "", a, 0 ) )
print( a )
print( a )
print( Bacon( "", a, 0 ) )
print( Bacon( "", a, 0 ) )
Line 655: Line 658:
{{out}}
{{out}}
<pre>
<pre>
>lua -e "io.stdout:setvbuf 'no'" "bco.lua"
sh-4.3$ lua main.lua
chAsE the pig ArOUnD tHE HOuSe pRESeNt BeLly, ScrAtch HANd When sTRokEd. when in douBT, WAsH jUMp AroUNd On COUcH, meOW COnStAntlY unTil given fOoD, FaVoR PACkagINg Over toY. AnD soMetIMES sWitcHEs in FreNch AND saY 'mIAoU' jUst BeCAuse wELL Why not Has CLosED EYEs bu
One MOrnING, wHen gRegOr SAmSa wOke fRom TrOUbLed dreaMS, hE found Himself trAnsFORmeD In HIS bEd intO a hOrribLE VErmIN.
FALL OVER DEAD NOT REALLY BUT GETS SYPATHY
He lAy oN his ARMoUr-LikE BacK, anD if He LifTE
THIS IS A BACON CIPHER TEST
</pre>
</pre>

=={{header|Perl 6}}==
=={{header|Perl 6}}==
Not truly a Bacon Cipher as it doesn't encode using font variations. But fits with the spirit if not the exact definition.
Not truly a Bacon Cipher as it doesn't encode using font variations. But fits with the spirit if not the exact definition.