Other ETA Example Programs
I will place more programs here as I write them. Comments welcome – mail ssjs.9.sts@xoxy.net
Rev Utility
.dalas a ni gge ym yrt uoy nehw yrraM .nup tes tup n'tfo ym evoba snup yrT .eurT .duola lla kculc kculc yas neh ynuP .tolb desu a tnuP .raet liarf a yrc naem stib desreveR:: ::Reversed bits mean cry a frail tear. Punt a used blot. Puny hen say cluck cluck all aloud. True. Try puns above my oft'n put set pun. Marry when you try my egg in a salad.
Hi Program
A suitable reply to the standard Hello World!
Drunk today,
Me awfully rather bladdered,
Do unlawful butchery coldly nine new ways at home,
Do crazy new nuts (red, and blue salty), but
Mummy normally says hear this:
Untold envy tends to make a tired owl...
...Hoot!
Noughts and Crosses Program
Also known as Tic Tac Toe. It’s too long to list here, but the simple source is here, the beautified version is here, and the eta-builder source is here.
Bi-lingual Cat Detector
This is a version of my cat detector program (as described in the ETA for Palm Pilot pages) that can be interpreted by any standard ETA interpreter, and also will interpret itself if you run it with Ruby.
ant=[]
net=DATA.readlines
$==f=c=0;l=11
loop{net[l-11].gsub(/(a)|(i)|(n)|(o)|(h)|(e)|(s)|t/){
f>0?$6?ant<<c&&c=f=0:(c="htaoins".index($&)+c*7): $1?ant<<l+2: $2?ant<<STDIN.getc: $3?f=
1:(z=ant.pop
$4?$><<z.chr: $5?ant<<ant[-1-z.abs]&&z>0&&ant.slice!(-2-z):(b=ant.pop
$6?ant<<b/z&&ant<<b%z: $7?ant<<b-z: b!=0&&(l=z-2
break)))}
l+=1;net[l-11]&&l>=11||break}
__END__
ntiteo: nice cat
ntsseo: bad cat
natieo: nice cat
nahoeo: bad cat
nttaeo: nice cat
niieo: no such cat
tate: mad cat
ine: happy cat
naehsnteh: nightmare cat
ntoes: naughty but nice cat
nanetn: a very fat cat
naee: nearly a tiger in fact
atnnhet: a cat came - but nice or not?
ntiteo: nice cat
natheo: nice cat
nahteo: nice cat
nahoeo: nice cat
niieo: nice cat
nahteo: nice cat
ntsseo: nice cat
naaieo: nice cat
nineo: nice cat
ntoeonet: good kitty
ntaoeo: bad cat
ntsseo: bad cat
nahaeo: bad cat
niieo: bad cat
nahteo: bad cat
ntsseo: bad cat
naaieo: bad cat
nineo: bad cat
ntoeonet: nasty kitty