WORKING ON SOLUTION: it's got wrong logic for ignoring wildcards during the cross-words check:
It uses unless(is wild) { do nothing } else { add score } when it should just be unless(is wild) { add score }. And it's checking a different column for the wild, when it really should be checking in the looped row
* replace
my $cc = $c - index ($_, "/") - 1;
with
my $vstart = $row - index($_, "/");
* replace the subsequent while(/(\w)/g) block with
while (/(\w)/g) {
# BUGFIX (pcj): use vrow as the row of the current letter of the vertical word
# if it's a wild, 0 points, else add its non-bonus value
my $vrow = $vstart + pos() - 1; # vstart is the start of the vertical word; pos is the 1-based position in the vertical word; -1 adjusts for the 1-based to get the row of the current \w character $1
unless ( $wilds[$vrow][$c] ) {
$t_score += $values{$1};
}
}; # end of vertical-word's real-letter score
I have a version with this bugfix, bundled with some of the other features I'm requesting in separate issues. I am working on getting them to a public repository for review, but I wanted to get these requests in the system first, and do a bit more testing on the bugfix.
HISTORY & DISCLAIMER: I've played various online scrabble-like games for a long time, including Literati and now Words with Friends. Back in about 2005, I wrote my own simple tile-player in perl; sometime between then and 2009, I found Games::Literati (which was much better than my script), and have been using a tweaked version as my "greedy opponent" player ever since (living with the effects of bug#29539 as a way to make it slightly less greedy). However, I finally decided I needed a greedier opponent, so started looking into the scoring bug, along with cleaning up my added features. If owner is amenable, I would be willing to co-maintain this module, and add all these features/fixes myself. If owner is unreachable in a month or two, I will probably request to adopt Games::Literati as having been abandoned.