Bug 156022 - KMahjongg generates non-solvable boards (at least when pressing shuffle)
Summary: KMahjongg generates non-solvable boards (at least when pressing shuffle)
Status: CONFIRMED
Alias: None
Product: kmahjongg
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Mauricio Piacentini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-17 19:13 UTC by Maarten Fonville
Modified: 2015-01-26 00:51 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of unsolvable game (200.29 KB, image/png)
2008-08-16 04:06 UTC, Tim Hoppen
Details
Disable redo after shuffle (725 bytes, patch)
2014-12-24 00:29 UTC, Jan-Peter Nilsson
Details
Shuffling CAN create an unsolvable game, as shown in these screenshots. (94.22 KB, image/png)
2015-01-26 00:49 UTC, Ian Wadham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Fonville 2008-01-17 19:13:43 UTC
Version:            (using KDE 4.0.0)
Installed from:    Ubuntu Packages
OS:                Linux

KMahjongg generates non-solvable boards when pressing shuffle and I also suspect this is the case when generating the board (altough i cannot be sure).
The Gnome Mahjongg version is always generating a board that is in some way solvable. I suggest the same feature should be available for KMahjongg to make sure people have a 'fair game' they can win.
Comment 1 Tim Hoppen 2008-08-16 04:06:15 UTC
Created attachment 26872 [details]
Screenshot of unsolvable game

This puzzle started off unsolvable. The matches for the tile at the very top 
only two, not three) were all below it. When first ran out of moves, I had not
found a match for the top tile. I shuffled the board until I got to the point
depicted in the screen shot.
Comment 2 Antonis Tsiapaliokas 2010-11-02 11:11:04 UTC
Hello

I have tried to reproduce the following bug but i could not. Because i won the game :) So i guess that there is no bug... Or this might be a kde 3 bug, since the screen shot which Tim has attached is from the kde 3.. Here is some information about my system.

OS: opensuse 11.3
kde: 4.5.73 (from the trunk)

In my way to try to reproduce the bug i have done the following steps:

1)run the game
2)shuffle 
3)won the game

I have a screen shot from my win but i could not upload it because it too big...
Comment 3 Maarten Fonville 2010-11-02 11:28:05 UTC
The bug was valid on KDE 4.0
I don't know whether it is still valid, since I have no KDE install to my availability anymore.
Comment 4 Christoph Feck 2013-02-08 00:02:22 UTC

*** This bug has been marked as a duplicate of bug 314219 ***
Comment 5 Martin Walch 2014-08-30 12:49:46 UTC
The shuffle option renders games unsolvable when used in conjunction with undo/redo operations (KDE 4.14.0).

It is pretty easy to reproduce:
* start a new game
* remove a matching pair
* undo removing
* shuffle
* redo removing

Unless the now newly removed tiles incidentally are the same as before, the game is now in an invalid state. (Things get even more crazy if you then shuffle again and again undo the last action.)

Reopening this bug as it involves the shuffle operation, which makes it different from bug #314219.
Comment 6 Jan-Peter Nilsson 2014-12-24 00:29:35 UTC
Created attachment 90112 [details]
Disable redo after shuffle

This only address the problem described in Comment 5.

Looking at the shuffle code in GameData my understanding is that it just randomly swaps around the tile faces, so I think the first part is valid as well and not a duplicate of bug 314219.
Comment 7 Ian Wadham 2015-01-26 00:49:22 UTC
Created attachment 90660 [details]
Shuffling CAN create an unsolvable game, as shown in these screenshots.