Bug 184592

Summary: KMahjongg seems ridiculously difficult
Product: [Applications] kmahjongg Reporter: JCooper <jmichc>
Component: generalAssignee: Mauricio Piacentini <piacentini>
Status: RESOLVED FIXED    
Severity: wishlist CC: bugzilla, iandw.au, kde-games-bugs, mpartap
Priority: NOR    
Version: 0.8   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: check this out
strangeness
Ouch.

Description JCooper 2009-02-17 07:15:48 UTC
Version:           0.8 (using KDE 4.2.0)
OS:                Linux
Installed from:    Ubuntu Packages

KMahjongg 0.8 looks great, but is by far the most difficult computer-based Mahjongg solitaire game I have ever played (please compare with Gnome's Mahjongg game). It seems to me that this is the case to the point of silliness. Could there possibly be a selection of difficulty levels added at some point?  Other than this, great job!
Comment 1 Mauricio Piacentini 2009-02-17 12:24:31 UTC
Hi, Jeff. It should not be more difficult than the version in KDE3, as the rules are the same. Maybe we need easier layouts? What exactly makes you feel it is more difficult, can you explain it a bit more?
Comment 2 Ian Wadham 2009-02-17 22:09:15 UTC
I get the same impression ... and more so with KShisen which I play regularly, 
but I play KMahjongg not as often.  I usually play KShisen 18x8, medium 
difficulty, with gravity, typically winning once every 2 or 3 games, but I 
have not been able to win either KMj or KSh for a week or more now.
Comment 3 Viktor S 2009-02-18 00:30:38 UTC
I agree. Most of KMahjongg's games seems to end in tiles being blocked and thus the board is not solvable, moreso than it's Gnome counterpart. I'd estimate I solve anywhere between 50-75% of Gnome's Mahjonggboards, on KDE4 it's at best 20%. The tiles are also better on the Gnome version of the game, they're more easily identifiable although the default one on KDE is on an acceptable level.
Comment 4 Mauricio Piacentini 2009-02-18 01:01:45 UTC
This is interesting. I guess providing easier layouts can help to some degree. Notice that there have been absolutely no changes to the tile sorting and distribution code since the original KMahjongg was available, several years ago. I wonder why this perception is arising now. Maybe there is a subtle bug we are not seeing?
Comment 5 Marcel Partap 2009-02-23 04:27:17 UTC
Created attachment 31557 [details]
check this out
Comment 6 Marcel Partap 2009-02-23 04:28:30 UTC
Created attachment 31558 [details]
strangeness
Comment 7 Marcel Partap 2009-02-23 04:29:07 UTC
Created attachment 31559 [details]
Ouch.

There's definitly something wrong here.
Comment 8 Ian Wadham 2009-02-23 09:25:47 UTC
Marcel's first and third examples are rather like those I found in KShisen for bug report 184596 (mismatched tiles).  Maybe the two problems are related.  Certainly it would be much more difficult to win if there are mismatched tiles in the deal ...

Another funny thing happened (once only).  In KMahjongg I got a Default layout in which there were only three tiles in the second layer from the top, instead of the usual four.  Maybe the code somehow generated a tile name that was not in the SVG file, leaving an invisible tile in the pyramid?
Comment 9 Mauricio Piacentini 2009-02-25 04:22:13 UTC
Not sure if the issues are related, but there is definitely something strange going on. Marcel, what is the version of Qt installed on this system, can you tell?
Comment 10 Ian Wadham 2009-03-15 00:47:31 UTC
Try game number 1,354,255,047 in KMahjongg.  About 1 time in 4 I get a hole at the top-left corner of the third layer down (4x4 tiles, top-left missing).  Most times I get a blank tile there or sometimes a 3.  This is in Classic theme, with Chinese Landscape background. The deal with a hole in it is clearly unsolvable, since it contains an odd number of tiles.  In that deal, the two red dragons next to the hole can be played as first move, but obviously not when the top-left contains a tile.

I can reproduce the problem by starting KMj from fresh then asking for game 1,354,255,047, but have not so far got a hole if I play for a while and ask for Restart Game.  Sometimes when I get a full deal, but not when I get a hole, I see a kDebug message KMahjonggTileset::tileface: Client asked for invalid tileface id.  Not being a very good KMj player, I have not yet been able to see everything that is on the bottom layer in this game's deal (e.g. whether there are any unmatched tiles and which tiles they are).

In Default theme, same behaviour on game 1,354,255,047, but if you get a blank tile at top-left third layer down it does NOT match the one at bottom-left of the same layer.
Comment 11 Mauricio Piacentini 2009-03-17 14:45:18 UTC
Thanks for the detective work, Ian. I will investige it as soon as I have some time, maybe before the weekend!
Comment 12 Viktor S 2009-03-17 18:54:33 UTC
I played that game number a few times (4-5) a day ago or so but did not encounter what you experienced, and I solved it a number of times, think I failed once. I'm using the standard theme and background. I'll continue to try it a few times more though, however it's strange that the bug is not appearing each and every time.
Comment 13 Ian Wadham 2009-03-18 03:29:18 UTC
Viktor S: Please could you try some of the game numbers reported in earlier comments for this bug and also for bug 184596 and see if you get the same problems with mismatched tiles or holes in the layout?  If you do not, that might be a significant clue - maybe something about your software/hardware config makes KMahjongg run better ...  Use menu item Game->New Numbered Game...
Comment 14 Mauricio Piacentini 2009-03-21 03:45:28 UTC
SVN commit 942094 by piacentini:

Ufff... revert part of commit 913748. Attempted to 
fix a Krazy issue and ended up introducing a 
regression in the code that pairs tiles. Thanks to 
Ian and others for providing evidence of the bug.
BUG:184592
CCBUG:184592



 M  +8 -10     GameData.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=942094
Comment 15 Mauricio Piacentini 2009-03-21 03:46:13 UTC
*** Bug 184596 has been marked as a duplicate of this bug. ***
Comment 16 Marcel Partap 2009-03-25 19:38:01 UTC
Sorry for not replying Mauricio, am using the latest QT 4.5 checkout and it seems you have fixed the problem - well done, no holes in game #1354255047! First entry in the highscore list since switching to KDE4 - W0ohoO!
Comment 17 Ian Wadham 2009-03-26 22:25:04 UTC
Well done, Mauricio.  Thanks for fixing this.  I too am getting high scores with KMahjongg again.  There is even one of the new layouts, Clubs, which even I can solve almost every time ...  The game is so much more fun now.