Get back to “Jump to”

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 just 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";

Below is recreation of the scenes from UserFriendly comic strips:

$ ./ai-sid.pl
Is it blue?
Is it bigger than a breadbox?
Is it smaller than a breadbox?
Does it go wiki-wiki-wiki?
$ ./ai-pitr.pl
Is my name Mike Floyd?
Very clever Pitr is, Da?

Interestingly, both versions give opposite responses to the same question. Joining their standard inputs with standard outputs (as to make them talk with each other) does not yield interesting results.

Add a comment

  • Single Return produces a line break.
  • More then that creates a paragraph.
  • Text preceded by four spaces means a block of code.
  • *emphasis*, _emphasis_,
  • **strong emphasis**, __strong emphasis__,
  • `inline code`, ``code ` more inline code``,
  • [Link](http://example.com/),
  • [Link](http://example.com/ "Title") and
  • <http://example.com/>.

End of the page, get back to “Jump to”.