Package: scrabble Version: 1.5-1 Severity: normal Tags: patch
A non-numeric argument effectively prevents the computer from playing. I discovered this by attempting to ascertian whether scrabble had any options besides "level": $ scrabble --help No error messages were generated, however the computer exchanged a tile every turn. Examination of the source reveals that the argument parsing has only minimal error checking, thus the non-numeric value is retained in $Level. The ComputerTurn() sub consults the ChoiceWeight() sub for every playable word it finds, however given that $Level is non-numeric, ChoiceWeight() returns a null value. Therefore ComputerTurn() is left to conclude that no plays were possible and exchanges a tile. While this bug may eventually become a feature as a practice mode (perhaps Level 0), I think the following patch is prudent. Lastly, I should note that the patch implements \d+ as opposed to merely \d to facilitate future expansion of the ChoiceWeight() sub. -- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.10-1-686 Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) -- no debconf information *** scrabble.patch --- /usr/games/scrabble 2004-02-16 16:42:53.000000000 -0800 +++ ./scrabble/scrabble 2005-02-14 04:19:39.000000000 -0800 @@ -1075,7 +1075,7 @@ $Level = shift @ARGV; -unless ($Level) { +unless ($Level =~ /^\d+$/) { $Level = 1; print "Use: $0 <level> (where level is 1 to 5)\n"; print "Level \#1 (easiest) assumed...\n"; -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]