Skip Menu |

This queue is for tickets about the Games-Literati CPAN distribution.

Report information
The Basics
Id: 29539
Status: resolved
Priority: 0/
Queue: Games-Literati

People
Owner: petercj [...] cpan.org
Requestors: gbrock [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.01
Fixed in: 0.031



Subject: Bonus scoring on bonus is counted only once per turn even if it makes two words
Hi, Love "Games::Literati"! It's a really neat module and I have enjoyed reading the code. One small niggle. When calculating the score for a possible solution, that makes multiple words from with a letter on a bonus tile (e.g. double letter score), the bonus is only calculated for one of the words. I believe that according to scrabble rules, the bonus should apply for each word created. e.g. for a board like this. Assume top-left is double letter score. .n .. If the player plays "in": in n. The score should be (2*1 + 1) + (2*1 + 1) = 6 The current code gives (2*1 + 1) + (1 + 1) = 5 I will continue to see if I can patch this, but I wondered if the solution may be obvious to you. Regards, Gavin Brock -- Show quoted text
_____________________________ Gavin Brock - gbrock@cpan.org ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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.
I have verified that Games::Literati::wordswithfriends() in v0.03 will score words-with-cross-words identically to the online Words With Friends game for multiple turns, including some that cross multiple bonuses. Updated source code v0.03 available in <https://github.com/pryrt/Games-Literati>
On Fri Feb 26 17:58:48 2016, PETERCJ wrote: Show quoted text
> I have verified that Games::Literati::wordswithfriends() in v0.03 will > score words-with-cross-words identically to the online Words With > Friends game for multiple turns, including some that cross multiple > bonuses. > > Updated source code v0.03 available in > <https://github.com/pryrt/Games-Literati>
@CCZ: If you're okay with these updates, if you give me co-maint, I am happy to make the release for you. I appreciate the effort that you put in to the v0.01, and my suggestions and fixes are because I enjoy the module so much.
Subject: Re: [rt.cpan.org #29539] Bonus scoring on bonus is counted only once per turn even if it makes two words
Date: Sat, 27 Feb 2016 08:17:21 +0900
To: "bug-Games-Literati [...] rt.cpan.org" <bug-Games-Literati [...] rt.cpan.org>
From: chris zhang <chichengzhang [...] hotmail.com>
Peter, thanks much for the interest and new add-ons! I no longer maintain the module, if you don't mind please take it over. Enjoy! Show quoted text
> On Feb 27, 2016, at 8:07 AM, Peter C. Jones via RT <bug-Games-Literati@rt.cpan.org> wrote: > > Queue: Games-Literati > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=29539 > >
>> On Fri Feb 26 17:58:48 2016, PETERCJ wrote: >> I have verified that Games::Literati::wordswithfriends() in v0.03 will >> score words-with-cross-words identically to the online Words With >> Friends game for multiple turns, including some that cross multiple >> bonuses. >> >> Updated source code v0.03 available in >> <https://github.com/pryrt/Games-Literati>
> > @CCZ: If you're okay with these updates, if you give me co-maint, I am happy to make the release for you. I appreciate the effort that you put in to the v0.01, and my suggestions and fixes are because I enjoy the module so much.
RT-Send-CC: chichengzhang [...] hotmail.com
Show quoted text
> Peter, thanks much for the interest and new add-ons! I no longer > maintain the module, if you don't mind please take it over. Enjoy!
Thanks. I'll have to pester you one more time: PAUSE/CPAN requires that you do the transfer of ownership, per http://www.cpan.org/modules/04pause.html#set-primary-maintainer: 0. Log into PAUSE (pause.cpan.org) 1. Visit the Change Permissiosn menu item 2. Click on "SELECT" in 2.1 "Transfer Primary..." (no need to select any names yet) 3. In the new page select the names of the modules you'd like to transfer. (Remember, in order to transfer the right to upload a distribution, you need to transfer the rights to every module in that distribution.) 4. Type in the PAUSE ID of the designated new primary maintainer: PETERCJ 5. Click on Pass Maintainership Status If you no longer have your PAUSE password, let me know, and I'll use this conversation as proof of your intentions and ask the PAUSE/CPAN admins to help transfer the ownership. Thanks again.