[Kde-games-devel] Review Request 109880: New shuffling algorithm

Ashwin Rajeev ashwin_rajeev at hotmail.com
Wed Apr 10 14:41:40 UTC 2013



> On April 9, 2013, 10:38 p.m., Albert Astals Cid wrote:
> > src/abstractgrid.cpp, line 157
> > <http://git.reviewboard.kde.org/r/109880/diff/4/?file=131939#file131939line157>
> >
> >     We are actually not shuffling all the cells anymore, are we? Can you explain where the cellCount *8 / 10 comes from?
> 
> Ashwin Rajeev wrote:
>     const int MinimumNumCells = cellCount() * 8 / 10; // minimum number of non-empty cells in a difficulty level. This is used while generating board.
>     There is no particular reason for choosing the same a shuffleLimit.

I now remember why i choose shuffleLimit same as MinimumNumCells. Even at worst case ( rand() % 3 + 1 never produced 2 and number of filled cells = MinimumNumCells ) this algorithm will work fine. For a higher shuffleLimit !cellsNotSuffled.isEmpty() is needed along with m_minimumMoves < shuffleLimit to ensure correctness of that loop. But then minimum moves will have a value in the range MinimumNumCells and shuffleLimit.


- Ashwin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109880/#review30823
-----------------------------------------------------------


On April 10, 2013, 2:29 p.m., Ashwin Rajeev wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/109880/
> -----------------------------------------------------------
> 
> (Updated April 10, 2013, 2:29 p.m.)
> 
> 
> Review request for KDE Games, Albert Astals Cid and Parker Coates.
> 
> 
> Description
> -------
> 
> Instead of randomly rotating every cell, rotate random cells such that initial and final state are not same and minimum moves to win is equal to shuffle limit.
> 
> This will also make sure the highscore is impartial on every game.
> I am also thinking of committing new highscore method since this patch will make getting highscore impossible for some cases.
> 
> 
> This addresses bug 160470.
>     http://bugs.kde.org/show_bug.cgi?id=160470
> 
> 
> Diffs
> -----
> 
>   src/abstractgrid.cpp 63ed8b8 
>   src/globals.h 6df25a0 
> 
> Diff: http://git.reviewboard.kde.org/r/109880/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Ashwin Rajeev
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20130410/61993ee0/attachment.html>


More information about the kde-games-devel mailing list