A.I.
Posted by Michał ‘mina86’ Nazarewicz on 22nd of September 2013
While cleaning Tiny Applications Collection a little I’ve dropped both artificial intelligence scripts. However, not wanting to let them disappear, I’ve decided to post them here for posterity.
The first one is an eight line of code version that might be what Sid wrote as his first program ever:
#!/usr/bin/perl -wWtT while (<>) { if (/[aeiouyAEIOUY][^a-zA-Z]*$/) { print "Yes.\n"; } elsif (!/^\s*$/) { print "No.\n"; } }
The second one is an ‘improved’ six-line version akin to Pitr’s code:
#!/usr/bin/perl -wWtTn if (/[aeiouyAEIOUY][^a-zA-Z]*$/) { print "No!\n"; } elsif (!/^\s*$/) { print "Yes.\n"; }