Sunday, 14th Dec, 2008
Overthinking It™ love it when a program comes together.
Because I’m a nerd, I re-wrote the program in Ruby. I know. I know.
Hmm. Will this descend into a sort of “how many languages can we write this in?” fest? I’ll see your Ruby and raise you a Perl.
#!/usr/bin/perl -w
use strict;
sub yn { $_ = shift; print; $_ = ; /y/i };
if ((yn "Do you have a problem? (y/n): ")
&& (!yn "Can anyone else help? (y/n): ")
&& (yn "Can you find them? (y/n): ")) {print "Maybe you can hire⦠the A-Team!\n";}
else {print "You Cannot Hire the A-Team.\n"};
Gick. It got mangled by the formatter! You need a line break after the first line.
And thinking about it, maybe I should have put the (y/n): within the function. And made that regular expression /[yj]/i for compatibility with German-speakers. Or /[yjos]/i for compatibility with German, French and Spanish-speakers.
Nah, s*d it ….. I can always put some of those features into the next release. And if I can’t think of anything to add to the next-plus-one release, then I’ll just hold something back from the next one.
Wow. I, sir, salute you.
Lee
December 14, 2008 at 5:44 pm