shlomif / PySolFC

A comprehensive, feature-rich, open source, and portable, collection of Solitaire games.
http://pysolfc.sourceforge.net/
GNU General Public License v3.0
460 stars 105 forks source link

the setting of the cardset for Memory-games doesn't get saved #395

Open hajo4 opened 2 weeks ago

hajo4 commented 2 weeks ago

that means, they get the cardset from the last game played.

Eg: playing memory16, setting cardset maching, going to freecell, with cardset default, gaing back to memory16 - it now also has cardset default,

BTW, it would be nice if the games memory-16, -24, -30, -40, -52 each could have their own setting of cardset (eg default, matching, ishido, matrix, hanafuda, tarok, mahjong ...)

joeraz commented 2 weeks ago

For Matching type games like Memory, I can confirm that the cardset is saved correctly. However, the cardset is not switched unless the current cardset is not compatible with the new game. For Matching type games, all cardsets are compatible, as long as they contain at least as many different cards as are needed for that particular game (i,e, 20 cards for Memory 40). You can see this in action if you switch from one of the smaller Tile Puzzle or Picture Matrix games to Memory 52.

For chosen cardset settings, it's one for the active cardset, plus one for each type/subtype combination. As all of the chosen cardsets are loaded into memory, I don't want to create additional types or subtypes without a very good reason.

hajo4 commented 2 weeks ago

cardset is saved correctly

OK: playing memory-16, setting cardset maching, going to memory-24, is still has cardset maching,

But then going to freecell, with cardset default, and coming back to memory-16 - it has cardset default now, not cardset matching as set before.

Both matching and default should be compatible with memory-games ? Maybe that check has a problem ?

joeraz commented 2 weeks ago

Like I said, it only changes if the current cardset is not compatible with the new game. A French cardset is compatible with Matching games, so no change.

If you go Memory 24 > Tile Puzzle 3x3 or Picture Matrix 3x3 > Memory 24, you'll see this in action, as the cardsets used in those games have less than 12 cards, and thus are not compatible with Memory 24.

It's done this way to keep changes seamless when there isn't a reason to switch cardset (could be confusing otherwise when dealing with joker decks, for example).

hajo4 commented 2 weeks ago

French cardset is compatible with Matching games, so no change.

Well,, this is fairly unexpected behavior for someone who selected cardset matching for memory-games. How can he make his selection stick (and still play other games like freecell, or mahjong) ?

joeraz commented 2 weeks ago

While I see where you're coming from, if we change this, it would cause similar unexpected behavior for different types of cardsets (such as French decks with jokers vs. decks without). It could be made a config option, or custom logic could be written so each type of cardset handles incompatible cardsets differently, though either would be a larger undertaking.

hajo4 commented 2 weeks ago

There already is a message 'cardset not compatible', eg. when going from memory-16 with cardset Dojouii Ukiyo E to memory-24.

Wouldn't that take care of any such problems ?

Maybe that dialog could suggest some cardset right away, eg. one of the 'most compatible' cardsets.

joeraz commented 2 weeks ago

That message is basically the last resort when it can't find a compatible cardset for the game you're starting (both the currently selected cardset and the cardset selected for that type/subtype are not compatible), so PySol won't be forced to start the game with an incompatible cardset.