Comment on

 Need Help??
This is my second attempt at Perl Golf. Although my score (281) sucks, I wanted to post my code because I had a hard enough time just getting it to work at all. :-) I know I could make my code more concise, but I've run out of time! I've got to actually get some work done today!

My free subs:

```sub a {
print shift;
return 1 if \$answer =~ /y/i;
return 0;
}

sub t {
}

sub i {
my (\$g, \$u) = @_;
print "What is a question that is true for \$u, but false for \$g?\n
+";
}

sub w {
print "Do you want to continue?\n";
return 1 if \$answer =~ /y/i;
return 0;
}

sub g {
my \$animal = shift;
print "n" if \$animal =~ /^[aeiou]/;
print " \$animal?\n";
return 1 if \$answer =~ /y/i;
return 0;
}

My free initialization:

```my @t = (
[
undef,undef,
]
);

And my long-winded (281) solution:

```sub r{my\$t=shift;my\$x=a(\$t->[2][2]);\$t->[\$x]?r(\$t->[\$x]):return \$t->[2
+][\$x]}sub
n{my\$t=shift;for(0,1){if(\$t->[2][\$_]eq\$b&&!\$t->[\$_]){\$t->[\$_]=[undef,u
+ndef,[\$b,\$
a,\$q]];return 1}last if\$t->[\$_]&&n(\$t->[\$_])}}while(1){\$b=r(\$t[0]);if(
+!g(\$b)){\$a
=t();\$q=i(\$b,\$a);n(\$t[0])}last if!w()}

In reply to Re: (Golf) The Animal Game by redsquirrel
in thread (Golf) The Animal Game by Masem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2017-07-21 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
I came, I saw, I ...

Results (326 votes). Check out past polls.